Authenticate on your server
Your server must authenticate the customer and resolve their OpenCX contact. It then chooses an authorized phone agent or support team and calls Create an app voice call with an API key holdingphone:write.
Never put a permanent API key in a website or mobile app. Do not accept an arbitrary contact ID or privileged routing destination from the client. Membership in your app must be checked before returning call credentials.
{ type: 'team', id: teamId } to start with a human team. The team must belong to your organization and have support enabled. App calls use that team’s routing and queue settings. A direct team call does not spill into unrelated teams when nobody is available.
For AI calls, configure the agent’s languages and permitted human-team transfer destinations in the dashboard. App-call agents support team and end-call destinations. Agents with telephone-number or external telephony transfer destinations are rejected; use a dedicated app-support agent if your phone agent needs those destinations. No dialed phone number is available to select a country flow: choose the appropriate destination on your server.
Call creation returns callId, sessionId, serverUrl, participantToken, controlToken, and expiresAt. Pass this object to the SDK unchanged. Treat both tokens as secrets; do not log them, place them in page URLs, or store them persistently. The SDK connects and activates the call. An abandoned connection attempt expires automatically, and active calls have a server-enforced duration limit.
Reuse requestId only for retries of the same creation attempt. Different settings with the same ID fail. After a call starts or ends, use a new request ID for another call. One customer can have one active app call at a time.
Web
Install the preview package supplied by OpenCX:setMicrophone(deviceId) and setAudioOutput(deviceId) select audio devices where the browser supports them. If audio playback is blocked, show a button that calls resumeAudio(). Microphone access requires HTTPS (localhost is allowed for development). Embedded frames require microphone permission from the host page. Customers can refuse or revoke microphone access; display the SDK error and offer another support channel.
Subscribe before calling start(). The states are idle, connecting, waiting, queued, connected, reconnecting, and ended. A queue notification or ringing agent is not proof a human answered. connected reflects an observed ready support participant. An ended state means the local microphone is stopped; if server hangup fails, an error is also emitted and server cleanup remains responsible for the room.
iOS
Add the suppliedOpenCXVoice Swift package to your app. Include NSMicrophoneUsageDescription in your app’s privacy settings. The SDK requests audio permission before creating a call.
Android
Add the suppliedcx.open:voice-android:0.1.0 package from your configured preview repository. Request RECORD_AUDIO permission before starting a call. Use the SDK from the main thread and collect state in your app’s lifecycle.
Session history and recording
sessionId identifies the OpenCX support session. App calls use the existing voice session history and configured recording behavior. Choosing app calling does not grant permission to read other sessions. Make your recording notice and retention policy available before the customer starts speaking.
Troubleshooting
Test your supported browser and device versions, human acceptance, unavailable teams, queues, hangup during connection, and Wi-Fi/cellular changes before enabling this for customers.