# How does Open CTI empower developers to integrate custom telephony solutions into the Service Console?

**Topic:** Service Cloud · **Difficulty:** Medium · **Tags:** Service Cloud, Open CTI, APIs

Read it on the site: https://www.forcechallenges.com/interview-questions/how-does-open-cti-empower-developers-to-integrate-custom-telephony-solutions-into-the-service-console

## Answer

**Basics:** The adapter is just a web page served over HTTPS. Salesforce loads it in the softphone utility; the page includes the Open CTI JavaScript library and calls its methods to talk to Salesforce. This removes installed desktop CTI adapters.

**How it works:**
1. Create a Call Center definition XML (internal name, display name, adapter URL, softphone size, reqUseApi = true) and import it at Setup > Call Centers.
2. Add users to the call center.
3. For Lightning, add the Open CTI Softphone utility item to the console app.
4. The adapter page loads the opencti.js library from the org's domain and registers handlers.
5. When a call arrives, the adapter calls screenPop or searchAndScreenPop; on click-to-dial, onClickToDial fires; when the call ends, saveLog creates the Task.

**Advanced / deep dive:** Common methods: enableClickToDial, onClickToDial, screenPop, searchAndScreenPop, saveLog, setSoftphonePanelVisibility/Height/Width, getAppViewInfo, onNavigationChange, runApex (calls an Apex method allowed in the Call Center definition's allowed namespace). Keep call state in the telephony backend; Open CTI should be a thin client. Because it lives in an iframe in a single softphone, it is not integrated with Omni-Channel capacity: use Omni-Channel Presence APIs separately or choose Service Cloud Voice for unified routing. Secure the adapter hosting, restrict origins, and include the adapter domain in your trusted URLs/CSP configuration (verify current requirements).

**Code / config example:**
```javascript
// Inside the adapter page, after loading opencti.js from the org
sforce.opencti.enableClickToDial({ callback: r => console.log(r.success) });
sforce.opencti.onClickToDial({ listener: payload => startCall(payload.number) });

function onIncomingCall(ani) {
  sforce.opencti.searchAndScreenPop({
    searchParams: ani,
    queryParams: '',
    callType: sforce.opencti.CALL_TYPE.INBOUND,
    callback: r => { if (!r.success) console.error(r.errors); }
  });
}
```

**Hidden gotchas & must-remember points:**
- The adapter URL must be HTTPS and reachable from the agent's browser.
- Lightning and Classic use different library paths and behaviors; do not copy Classic samples.
- The softphone only loads when the utility is initialized; calls before load can be missed.
- runApex is limited to methods in the allowed Apex namespace.
- Open CTI does not provide recording or transcription natively.

**Best practice:** Keep the adapter stateless, handle softphone reloads, and log every call even on failure paths.

---
Source: ForceChallenges · last updated 2026-11-02
