#1613 callToLink "+" character replacement leads to wrong phone number

v5.x
closed
nobody
None
1
2014-08-01
2014-05-30
Bernhard Fischer
No

A "+" inside a phonenumber will end up in a space character inside the callToLink. It should be replaced by "%2B", otherwise the calling process will lead to the wrong number.

While using a http url in the callToLink, it would also be nice to send the username to the voip server. The server may need the information "who wants to call which number". A example string could look like:

$config["callto_template"]='http://sip.acme.org/dial?to={phone}&user={user}';

GO.util.callToLink = function (phone) {
    // request a _blank target
    // replace "+"
    // insert the username
    return '<a onclick="GO.mainLayout.fireEvent(\'callto\', \'' +
    phone + '\');" target="_blank" href="' +
    GO.calltoTemplate.replace('{phone}',
        phone.
            replace('(0)', '').
            replace(/[^0-9+]/g, '').
            replace(/^\+/, '%2B')
    ).replace('{user}', GO.settings.username) +
    '">' + phone + '</a>';
};

Discussion

  • missed to mention: this patch is related to "views/Extjs3/javascript/common.js"

     
    • status: open --> closed
     
  • We made this configurable now.