developerforce / open-cti-demo-adapter

Other
91 stars 95 forks source link

CTI JS not loading up #10

Open nikhilcloudroute opened 6 years ago

nikhilcloudroute commented 6 years ago

Hi There,

I am getting "Uncaught Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters" After debugging the /support/api/38.0/lightning/opencti.js at line 73, param.mode is undefined. How do we set this ?

Regards.

nikhilcloudroute commented 6 years ago

@dlouvton Can you help with this?

Sarabjee361 commented 6 years ago

@nikhilcloudroute did you figure out the problem, I am also having the same issue

nikhilcloudroute commented 6 years ago

@Sarabjee361 I haven't looked at that after i posted it. I have this in my todo list this week. Will drop you a note if i find any solution, or you can if you find any solution by yourself.

nikhilcloudroute commented 6 years ago

`

<div id="lightning"></div>
<apex:outputpanel layout="none" rendered="{!!CONTAINS($CurrentPage.URL, 'lightning.force.com')}"> 
    <script src="/support/api/40.0/interaction.js" type="text/javascript"></script>
    <script type="text/javascript">
    $Lightning.use("CTIAdapterOut", function() {
        $Lightning.createComponent("CTIAdapter", 
                                   {"isLex" : 'false'},
                                   "lightning",
                                   function(cmp) {
                                   });
    });
    sforce.interaction.cti.setSoftphoneHeight(400);
    sforce.interaction.cti.disableClickToDial();
    </script>
</apex:outputpanel> 
<apex:outputpanel layout="none" rendered="{!CONTAINS($CurrentPage.URL, 'lightning.force.com')}"> 
    <script src="/support/api/40.0/lightning/opencti_min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $Lightning.use("CTIAdapterOut", function() {
        $Lightning.createComponent("CTIAdapter", 
                                   {"isLex" : 'true'},
                                   "lightning",
                                   function(cmp) {
                                   });
    });
    sforce.opencti.setSoftphonePanelHeight({heightPX:450});
    sforce.opencti.disableClickToDial();
    </script>
</apex:outputpanel> 

</apex:page>`

nikhilcloudroute commented 6 years ago

@Sarabjee361 This worked for me.

Sarabjee361 commented 6 years ago

@nikhilcloudroute Thanks for the sharing the solution, I would like to know how are you using this, I mean you have created a apex page inside salesforce and using the page as adaptor ?

nikhilcloudroute commented 6 years ago

I am using salesforce lightning out in the lightning component, then this lightning component is used inside a VF page(above code is for Vf). You can find the complete code https://github.com/developerforce/open-cti-demo-adapter/blob/master/src/aura/demoAdapterOut/demoAdapterOut.app