Summary:

CTI Integration with Customized Format that supports RFC4967

Description: 

A mechanism to express a dial string in a 'sip:' or 'sips:' URI is required. To know more about RFC 4967, Please refer this link: http://www.networksorcery.com/enp/rfc/rfc4967.txt

You can customise your code according to the package. For this, Please follow the below steps:

1. Create a javascript file.

2. Now you can write code according to your desired pacakge. Here i'm taking an example with RFC 4967.

3. In this we include 'callto:' or 'sip:' before any numbers. I'm taking the example with 'Callto'.

crm.ready(function ()

{

 var TDs = document.getElementsByTagName("td");
 for (var i = 0; i < TDs.length; i++) {
 var tdVal = TDs[i].innerHTML;
 var phoneno = /^\+{0,1}[0-9 \(\)\.]{7,}$/g;
 var cleansedNo = '';
 if (phoneno.exec(tdVal) !== null)

 {
  cleansedNo = RegExp.$1;
  cleansedNo = tdVal.replace(/^\+/, '00').replace(/\([0-9]+\)/g, '').replace(/\D/g, '');
  if (!tdVal.indexOf("</a>") > -1)

  {
    TDs[i].innerHTML = '<a href="' + "callto:" + cleansedNo + '">' + tdVal + '</a>';
  }
 else if (tdVal.indexOf("</a>") > -1)

{
  var aTags = TDs[i].getElementsByTagName('a');
  for (var j = 0; j < aTags.length; j++)

  {
     var aTagVal = aTags[j].innerHTML;
     if (tdVal.indexOf('showCti') >= 0)

     {
        $(aTags[j]).attr('href', 'callto:' + aTagVal);
     }
  }
 }
}
}
});

4. Place this file ..\CRM\WWWRoot\js\custom directory. This file will run on page load and convert the phone numbers into your desired format.

Note:

We haven't tested it with any integration. So, it's better to test it on your test environment.