sinch-in-app-calling
Sinch In-App Calling
Overview
Real-time voice and video SDK for Android, iOS, and JavaScript (Web). Connects to Sinch's cloud for signaling and routing.
Supported call types
- App-to-App (VoIP/WebRTC between users)
- App-to-Phone (call PSTN numbers)
- App-to-SIP (connect to PBXs, contact centers)
- App-to-Conference (multi-party calls)
- Phone-to-App / SIP-to-App (inbound calls)
Agent Instructions
Prerequisites
The user needs a Sinch account with an application key and secret from the Sinch Build Dashboard. See sinch-authentication for credential setup — In-App Calling uses application-scoped auth (Application Key + Application Secret).
Integration workflow
-
Detect the platform from the user's project (language, build system, framework):
- Android (Kotlin/Java, Gradle) → Read
references/android.md - iOS (Swift/ObjC, Xcode) → Read
references/ios.md - JavaScript/Web (npm, browser) → Read
references/js.md - If unclear, ask the user.
- Android (Kotlin/Java, Gradle) → Read
-
Walk through the integration steps in the platform reference. Go step by step — confirm each step is in place before moving to the next.
-
Ask about auth approach: Can the Application Secret be embedded (prototyping only) or must JWTs come from a backend (production)?
-
Ask about call types: Which types does the user need? This determines which sections to cover.
-
For Phone-to-App / SIP-to-App: The user needs a backend ICE callback handler. See the "Phone-to-App / SIP-to-App backend" section below.
SDK Init References
For detailed SDK initialization code per platform:
- Browser: references/sdk-init-in-app-calling-browser.md
- iOS: references/sdk-init-in-app-calling-ios.md
- Android: references/sdk-init-in-app-calling-android.md
Phone-to-App / SIP-to-App backend
Receiving inbound PSTN or SIP calls requires:
- A Sinch voice number from the Build Dashboard assigned to the app (or SIP origination configured).
- A callback URL in the app's Voice settings.
- A backend ICE handler that routes calls via
connectMxp:
{
"action": {
"name": "connectMxp",
"destination": {
"type": "username",
"endpoint": "target-user-id"
}
}
}
Key Concepts
- SinchClient — The core SDK object. Must be initialized with Application Key and started before any calls can be made or received.
- User Identity — A string identifier (e.g., user ID) that uniquely identifies a user in the Sinch system. Set during
SinchClientinitialization. - Call Types — App-to-App (VoIP), App-to-Phone (PSTN), App-to-SIP, App-to-Conference, and inbound (Phone-to-App, SIP-to-App).
- Managed Push — Sinch-managed push notifications for incoming calls when the app is backgrounded. Required on all platforms.
- JWT Authentication — Production apps must use backend-generated JWTs (not embedded secrets) for SDK authentication.
- ICE Callback — Incoming Call Event. A backend webhook handler required for Phone-to-App and SIP-to-App calls that routes calls via
connectMxp. - Environment Host — Regional endpoint for the SDK connection (e.g.,
ocra.api.sinch.comfor global routing).
Common Patterns
- App-to-App voice call — Initialize SinchClient with user identity, call
callUser("recipient-id"). Both users must have active SinchClient instances. - App-to-Phone (PSTN) — Call
callPhoneNumber("+15551234567")with a CLI (caller ID) set to a Sinch number. - Receive incoming calls — Register push notifications, implement call listener/delegate, handle
onIncomingCallevent. - Phone-to-App routing — Assign a Sinch number to the app, set up backend ICE callback that returns
connectMxpaction targeting the user. - Video calling — Use
callUserVideo("recipient-id")(or platform equivalent). Requires camera permissions.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
onClientFailed / clientDidFail |
JWT issue — token missing, expired, wrong secret, or malformed | Verify JWT generation: correct app key + secret, kid matches key ID, token not expired. See auth section in platform reference |
onClientFailed / clientDidFail |
Invalid app key or wrong environment host | Verify key in Dashboard; check environmentHost matches your region |
| No incoming calls (JS) | Managed push not enabled | Call sinchClient.setSupportManagedPush() before starting — required even for the caller side |
| No incoming calls (Android) | FCM misconfiguration | Verify FCM credentials in Dashboard ("In-app Voice & Video SDKs" → "Google FCM Identification"); check that the device receives FCM tokens |
| No incoming calls (iOS) | APNs push not configured or token stale | Verify push certificate/key in Dashboard; ensure registerPushNotificationData is called with a fresh device token |
| No incoming calls (general) | SinchClient not running on the receiver's device | The receiver's app must have an active, started SinchClient to receive calls. Verify start() completed successfully |
| App-to-Phone fails immediately | Missing CLI (caller ID) | Set callerIdentifier / cli with a Sinch number |
| Audio only in foreground (iOS) | CallKit not reporting calls | Report outgoing calls to CallKit for background audio |
If the above steps don't resolve the issue, instruct the user to contact Sinch Support with their app key, platform, and a description of the problem.
Public endpoints
Set environmentHost when creating the Sinch client:
| Endpoint | Region |
|---|---|
ocra.api.sinch.com |
Global (auto-routed) |
ocra-euc1.api.sinch.com |
Europe |
ocra-use1.api.sinch.com |
North America |
ocra-sae1.api.sinch.com |
South America |
ocra-apse1.api.sinch.com |
South East Asia 1 |
ocra-apse2.api.sinch.com |
South East Asia 2 |
Links
More from sinch/skills
sinch-conversation-api
Sends and receives omnichannel messages with Sinch Conversation API. One unified API for SMS, WhatsApp, RCS, MMS, Viber, Messenger, and more. Use when sending texts, WhatsApp messages, rich cards, carousels, templates, batch messages, or building multi-channel messaging.
81sinch-authentication
Configures Sinch API credentials and authentication. Use when setting up OAuth2, Basic auth, application signing, or API keys for any Sinch product including Conversation API, Voice, Verification, Numbers, Fax, and Mailgun. Also use when troubleshooting 401 Unauthorized, 403 Forbidden, invalid signature, or credential errors against any Sinch API. For SDKs usage, see sinch-sdks.
76sinch-mailgun
Sends, receives, and tracks email via the Mailgun (Sinch) API. Use when the user wants to send email, manage domains, configure webhooks, query email events/logs, manage templates, handle suppressions (bounces, unsubscribes, complaints), set up inbound routes, manage mailing lists, DKIM keys, or IP warmup using Mailgun.
74sinch-provisioning-api
Provisions and manages channel resources for Conversation API projects, including WhatsApp accounts/senders/templates, RCS senders, KakaoTalk senders/templates, webhooks, and bundles. Use when the user asks to onboard channels, configure provisioning webhooks, manage templates, orchestrate multi-service bundles, or automate channel setup.
73sinch-numbers-api
Search, rent, manage, and release phone numbers with the Sinch Numbers API. Use when listing active numbers, searching available numbers, renting or releasing numbers, updating number configuration (SMS/voice/callback), managing emergency addresses, or checking available regions.
71sinch-10dlc
Registers US 10DLC brands and campaigns with Sinch for A2P SMS messaging. Use when the user needs to register a brand, create a 10DLC campaign, check registration status, troubleshoot a 10DLC rejection, fix an EIN mismatch, upgrade from simplified to full registration, or qualify a campaign for US SMS sending on 10-digit long codes. Do NOT use for non-US messaging or toll-free/short code registration.
69