I have a Lightning instance which contains a Salesforce Classic Console App using Contacts, Leads and Accounts tabs. Inside of it I have an OpenCTI Phone which is made of Lightning components. During the initialization of one of the components I invoke a function which should enable a click-to-dial feature. Here's a simple code:

enableClickToDial : function(cmp) {
    const clickToDialListener = function(response) {
            console.log("Click-to-dial listener");

    var callback = function (response) {
       console.log("Callback invoked");
       if (response.result) {
          alert('Click to dial was enabled.');
       } else {
          alert('Click to dial was not enabled.');


    console.log("Enabling finished");

However, the callback is not invoked. I don't know what's happening since an "Enabling finished" message is printed out to the console - that means there was no error in enableClickToDial function and interpreter got to the next statement.

Also, a phone icon is grayed out:

enter image description here

Does anyone know the reason why is it not working properly?

  • "Enabling finished" is not an accurate statement; the callback is provided because the toolkit does the action asynchronously. You need to see "callback invoked" in the console to verify that it was successfully called. What does "response.error" say in the callback function? – sfdcfox Feb 16 '18 at 16:16
  • I've edited my post to make it clearer - I know "Callback invoked" should be printed out. I've mentioned "Enabling finished" to point out that the function was called and interpreter got to the nex statement. Speaking about response.error - it's impossible to know what did it contain since even "Callback invoked" wasn't printed - that means that the callback wasn't invoked. – notmyf4ulty Feb 16 '18 at 16:27

For anyone struggling with an issue of OpenCTI API methods not getting invoked without any visible cause - in our case this turned out to be the issue with Call Center configuration: the CTI Adapter URL was configured like so: apex/<softPhonePageName>, without the leading slash.

This was not an issue in terms of the SoftPhone page being displayed, but when trying to call the OpenCTI API, there is a check there, that compares the call origin with the configured CTI Adapter URL and without the leading slash it considered the domains to be different.

Changing the CTI Adapter URL to /apex/<softPhonePageName> resolved the issue.

The annoying part was that I had to debug the unminified source of the InteractionFramework to find it out - the error about the origin mismatch does not seem to surface anywhere in the JS console or the page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.