--- name: cti-adapter-development description: "Use when building or debugging a browser-based CTI softphone adapter using the Salesforce Open CTI JavaScript API — covers callcenter.xml definition, Lightning utility item registration, core API methods (enableClickToDial, onClickToDial, screenPop, setSoftphonePanelHeight, saveLog), call logging as Task, and the lightning-click-to-dial LWC component. NOT for Service Cloud Voice Amazon Connect setup, Omni-Channel routing configuration, or CTI adapter AppExchange package selection." category: apex salesforce-version: "Spring '25+" well-architected-pillars: - Security - Reliability - Operational Excellence triggers: - "How do I build a custom CTI softphone adapter in Salesforce Lightning?" - "Open CTI click-to-dial is not firing / onClickToDial callback never runs" - "How do I register a softphone in the Lightning utility bar using callcenter.xml?" - "CTI adapter not logging calls to Salesforce activities" - "How do I use setSoftphonePanelHeight or screenPop in Open CTI?" tags: - open-cti - cti-adapter - softphone - click-to-dial - call-logging - lightning-utility-bar - callcenter-xml inputs: - "Telephony vendor requirements (SIP endpoint, WebRTC or PSTN bridge details)" - "Lightning App where the softphone utility item should appear" - "Salesforce objects to screen-pop on incoming calls (Contact, Case, Lead)" - "Existing callcenter.xml or adapter page URL if already partially built" outputs: - "Compliant callcenter.xml Call Center definition file" - "JavaScript Open CTI adapter hosted page with API method implementations" - "Lightning utility bar softphone configuration steps" - "Call logging Task creation pattern using saveLog" - "lightning-click-to-dial LWC integration snippet" dependencies: [] version: 1.0.0 author: Pranav Nagrecha updated: 2026-04-06 --- # CTI Adapter Development Use this skill when building, diagnosing, or extending a browser-based CTI (Computer Telephony Integration) softphone adapter with the Salesforce Open CTI JavaScript API. It covers the full adapter lifecycle: defining the Call Center in `callcenter.xml`, registering it as a Lightning utility bar item, implementing core Open CTI API calls, enabling click-to-dial on phone fields, logging calls as closed Task records, and integrating with the `lightning-click-to-dial` LWC component. --- ## Before Starting Gather this context before working on anything in this domain: - Confirm the org has a Call Center definition registered under **Setup > Call Centers**. Open CTI requires a valid Call Center record tied to the user before any API calls succeed. - Identify which Lightning App hosts the softphone. The utility bar must be configured for that specific app — Open CTI softphones do NOT appear in the Salesforce mobile app or Classic UI. - Understand the telephony vendor's hosting requirements: the CTI adapter page (HTML + JS) must be served from a domain added to Salesforce CSP Trusted Sites and CORS allowed-origins. Omitting this causes the `sforce.opencti` namespace to fail silently. --- ## Core Concepts ### Open CTI JavaScript API Open CTI is a browser-side JavaScript API exposed by Salesforce. The API namespace is `sforce.opencti` and it is injected into the adapter page by the platform — you do not load it via a `