SIP - Dial In
Forwarding a PSTN Call Into a VideoSDK Room
When using Twilio as your SIP/PSTN provider, you may need to forward an incoming phone call into a specific VideoSDK meeting.
This is useful when:
- You want to route calls dynamically to different meeting IDs.
- You don't want to configure a fixed room inside VideoSDK Routing Rules.
Twilio requires a webhook endpoint that returns TwiML, telling Twilio which SIP URI to dial. This SIP URI connects directly to the VideoSDK SIP Gateway with the meeting ID appended as a query parameter.
Example: Node.js Express Webhook
Create a simple Express server that Twilio will call whenever someone dials your Twilio number.
const express = require("express");
const VoiceResponse = require("twilio").twiml.VoiceResponse;
const urlencoded = require("body-parser").urlencoded;
const app = express();
app.use(urlencoded({ extended: false }));
// This endpoint is called by Twilio on incoming PSTN call
app.post("/incoming-call-handler", (request, response) => {
const twiml = new VoiceResponse();
const dial = twiml.dial();
// Replace meetingId with the VideoSDK room you want to route the call into
const meetingId = "your-meeting-id";
// SIP address provided by VideoSDK Inbound Gateway
const sipUri = `sip:your_twilio_number@INBOUND_GATEWAY_ID?x-videosdk-room-id=${meetingId}`;
dial.sip({}, sipUri);
response.type("text/xml");
response.send(twiml.toString());
});
// Start server
app.listen(8000, () => {
console.log("Server running on port 8000");
});
How It Works
- Twilio receives an incoming call on your phone number, then it sends a webhook to your server for call instructions.
- Your server responds with TwiML containing the SIP URI + meeting ID.
- Twilio dials the VideoSDK SIP Gateway, which connects the caller into the meeting.
Got a Question? Ask us on discord

