Telephony Integration Guide
Digital Samba supports SIP/PSTN telephony integration allowing phone callers to join rooms. This guide explains how to build a custom telephony integration using any SIP/Voice API provider.
How It Works
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Phone Callers │────▶│ Your Voice │────▶│ Digital Samba │
│ (PSTN) │ │ API Provider │ │ Room │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
│ SIP Connection
▼
┌─────────────────┐
│ Your Middleware│
│ Application │
└─────────────────┘The integration consists of:
Voice API Provider - Handles phone calls, IVR prompts, and PSTN conferencing (e.g., Twilio, Sinch, Vonage, Plivo)
SIP Trunk - Connects your Voice API to Digital Samba
Middleware Application - Routes calls, manages PINs, and synchronises state between your Voice API and Digital Samba
Digital Samba Room - Video conferencing room with telephony enabled
Prerequisites
Before starting your integration:
Digital Samba Account with API access
Voice API Provider Account with:
A phone number for incoming calls
Voice/conferencing API access
SIP trunking capability
SIP Trunk Configuration - Contact Digital Samba support to configure IP whitelisting and authentication for your SIP trunk
Important: Before proceeding with implementation, contact Digital Samba support to set up your SIP trunk. Provide your SIP provider details and we will guide you through IP whitelisting and authentication configuration.
Architecture Overview
System Components
Call Flow Sequence
Step 1: Configure Digital Samba Room
Create a Telephony-Enabled Room
When creating a room via the API, include the telephony configuration:
Telephony Room Properties
telephony_enabled
boolean
Enable telephony for this room
telephony_phone_number
string
The phone number for SIP to dial into your Voice API conference
telephony_pin_dtmf
string
DTMF sequence for SIP to enter when connecting to the conference
DTMF Sequence Format
The telephony_pin_dtmf field uses special characters:
W
Wait 1 second (for IVR prompts)
w
Wait 0.5 seconds
0-9
Dial digit
*
Dial asterisk
#
Dial pound/hash (often used as terminator)
Example: WWW123# means:
Wait 3 seconds for IVR prompt
Dial
123Press
#to confirm
Step 2: Build Your Middleware Application
Your middleware application handles communication between your Voice API provider and Digital Samba.
Core Responsibilities
Handle incoming calls from your Voice API provider
Play IVR prompts and collect PIN input
Route callers to the correct conference based on PIN
Manage SIP connection to Digital Samba room
Synchronise phone user state with Digital Samba API
Handle webhooks from both Voice API and Digital Samba
Conference and PIN Management
Your application must maintain a mapping between:
Digital Samba room IDs
Voice API conference IDs
PINs for phone callers
PINs for SIP bridge connections
Important: Voice API providers do not have inherent knowledge of conferences until you create them. You must build your own database and logic to:
Generate and assign PINs
Map PINs to conferences
Route callers based on PIN input
Example PIN Structure
Identifying the SIP Connection
When the SIP bridge connects to your Voice API conference, you must identify it distinctly from regular phone callers. Common approaches:
Reserved PIN - Use a specific PIN only for SIP connections
Display Name - Check for a specific display name (e.g., starts with "SIP")
Origination Type - Check call metadata for SIP origin
Domain - Check if domain equals "SIP"
Critical: Do NOT notify Digital Samba when the SIP bridge joins. The SIP connection is not a "real" phone user—it's the audio bridge between your Voice API conference and the Digital Samba room.
Step 3: Digital Samba Phone User API
Notify When Phone Users Join
When a phone caller successfully joins your Voice API conference (after PIN validation and only after SIP is connected), notify Digital Samba:
Request Parameters
callId
string
Yes
Unique identifier for this phone call (from your Voice API)
name
string
No
Display name for the phone user
callerNumber
string
No
Phone number of the caller
externalId
string
No
Your internal user identifier
Note: The
externalIdparameter is reserved for future functionality. It may be used to link phone participants with web participants who share the same external ID.
Notify When Phone Users Leave
When a phone caller disconnects:
Raise Hand for Phone User
Lower Hand for Phone User
Step 4: Configure Digital Samba Webhooks
Set up webhooks to receive events from Digital Samba rooms. This enables you to synchronise actions (like mute/unmute) with your Voice API.
Create a Webhook
Relevant Webhook Events
participant_joined
Triggered when any participant (web or phone) joins
participant_left
Triggered when any participant leaves
session_started
Triggered when a room session begins
session_ended
Triggered when a room session ends
Webhook Security
Always validate that webhook requests are legitimately from Digital Samba by checking the Authorization header matches your configured secret.
Step 5: Initiate SIP Connection
When a moderator in the Digital Samba room clicks "Connect Telephony" (requires the "Manage phone users" permission), Digital Samba initiates a SIP call to your Voice API.
What Happens
Digital Samba's SIP server calls the configured
telephony_phone_numberYour Voice API answers and plays IVR
SIP sends the
telephony_pin_dtmfsequenceYour application routes SIP to the correct conference
Room audio is now bridged to the PSTN conference
Important Timing
Moderators should connect telephony early in the session if phone users are expected
Phone users who call before SIP is connected will be in the Voice API conference but won't hear room audio
Only notify Digital Samba of phone users after SIP has connected
Step 6: Managing Phone Users in Room
Once connected, phone users appear in the Digital Samba participant list. Moderators can:
See phone users in the participants panel
Mute/unmute phone users via the menu
Remove phone users from the room
Handling Mute/Unmute
When a moderator mutes a phone user in Digital Samba, you'll receive a webhook. Your middleware should then call your Voice API to mute that participant in the PSTN conference.
Integration Checklist
Before Development
[ ] Contact Digital Samba support to configure SIP trunk
[ ] Set up Voice API provider account with phone number
[ ] Understand your Voice API's webhook/callback structure
[ ] Plan your PIN/conference management strategy
Development
[ ] Create rooms with telephony enabled via API
[ ] Build middleware to handle Voice API callbacks
[ ] Implement IVR flow for PIN collection
[ ] Build PIN validation and conference routing
[ ] Integrate Digital Samba Phone User API
[ ] Set up webhook handlers for Digital Samba events
[ ] Implement mute/unmute synchronisation
Testing
[ ] Test phone dial-in flow end-to-end
[ ] Verify SIP connection with correct PIN/DTMF
[ ] Confirm phone users appear in Digital Samba room
[ ] Test mute/unmute from room to phone
[ ] Test phone user disconnect handling
[ ] Verify audio quality and latency
API Reference
Phone Participants Endpoints
POST
/api/v1/rooms/{room}/phone-participants-joined
Notify phone users joined
POST
/api/v1/rooms/{room}/phone-participants-left
Notify phone users left
POST
/api/v1/rooms/{room}/phone-participants/{callId}/raise-hand
Raise hand for phone user
POST
/api/v1/rooms/{room}/phone-participants/{callId}/lower-hand
Lower hand for phone user
Room Creation with Telephony
Include these properties when creating or updating rooms:
Troubleshooting
SIP Connection Issues
SIP cannot connect
IP not whitelisted
Contact DS support to verify IP whitelist
No audio after SIP connects
Wrong DTMF sequence
Verify PIN and timing in telephony_pin_dtmf
SIP connects but no phone users
Phone users notified before SIP
Only call phone-participants-joined after SIP connects
Common Mistakes
Notifying Digital Samba when SIP joins - The SIP bridge is not a phone user; do not send
phone-participants-joinedfor itPhone users notified before SIP connects - Phone users won't hear room audio until SIP is bridged; wait for SIP before notifying DS
Missing DTMF terminator - Many IVR systems require
#to confirm PIN entryInsufficient wait time - If IVR prompts are long, increase
Wcharacters in DTMF sequence
Support
For assistance with your telephony integration:
SIP Trunk Configuration : Contact Digital Samba support
Platform Documentation: docs.digitalsamba.com
API Reference: developer.digitalsamba.com
Sinch Middleware demo middleware: https://github.com/digitalsamba/sinch-conference-middleware
Appendix: Example Application Architecture
Data Flow Summary
Incoming Call → Voice API → Your App → Validate PIN → Join Conference
SIP Connection → Voice API Conference → Audio Bridge → Digital Samba Room
Phone User Joins → Your App → Digital Samba API (
phone-participants-joined)Moderator Mutes → Digital Samba → Webhook → Your App → Voice API Mute
Phone User Leaves → Voice API → Your App → Digital Samba API (
phone-participants-left)
Last updated