I am working on implementing OpenCTI in Salesforce Lightning, but problem getting the correct User Experience Context. When opening VF as softPhone in LEX it's returning $User.UITheme = "Theme3" although same page opened from tab returns "Theme4d".
Is there any way we can use same VF in classic and LEX or we have to create two separate call center and VF pages.
Below are my sample Call center definition and VF file along with SoftPhone result,
<section sortOrder="0" name="reqGeneralInfo" label="General Information">
<item sortOrder="0" name="reqInternalName" label="InternalName">OpenCTI</item>
<item sortOrder="1" name="reqDisplayName" label="Display Name">OpenCTI</item>
<item sortOrder="2" name="reqAdapterUrl" label="CTI Adapter URL">/apex/CTI_light</item>
<item sortOrder="3" name="reqUseApi" label="Use CTI API">true</item>
<item sortOrder="4" name="reqSoftphoneHeight" label="Softphone Height">530</item>
<item sortOrder="5" name="reqSoftphoneWidth" label="Softphone Width">205</item>
<item sortOrder="6" name="reqSalesforceCompatibilityMode" label="Salesforce Compatibility Mode">Classic_and_Lightning</item>
</section>
<section sortOrder="1" name="reqDialingOptions" label="Dialing Options">
<item sortOrder="0" name="reqOutsidePrefix" label="Outside Prefix">9</item>
<item sortOrder="1" name="reqLongDistPrefix" label="Long Distance Prefix">1</item>
<item sortOrder="2" name="reqInternationalPrefix" label="International Prefix">01</item>
</section>
<!-- panel to be displayed only in classic mode -->
<apex:outputPanel rendered="{! $User.UITheme == 'Theme3' }">
<apex:outputText value="This is Salesforce Classic."/>
<apex:includeScript value="/support/api/38.0/interaction.js"/>
</apex:outputPanel>
<!-- panel to be displayed only in Lightning -->
<apex:outputPanel rendered="{! $User.UITheme == 'Theme4d' }">
<apex:outputText value="This is Lightning Experience."/>
<apex:includeScript value="/support/api/38.0/lightning/opencti_min.js"/>
</apex:outputPanel>