Skip to main content

Call Transfer

Call transfer in SIP (Session Initiation Protocol) is handled using the SIP REFER event. This allows you to transfer an ongoing call to another destination (such as another phone number or SIP endpoint) without dropping the call. The transfer can be initiated programmatically using the VideoSDK API.

How Call Transfer Works

When a call transfer is triggered, the current call leg is instructed to REFER the call to a new destination. Once the transfer is successful, the original session is immediately ended and the caller is connected directly to the new destination.

note

Ensure that SIP REFER (call transfer) is enabled on your SIP provider's side. For Twilio, specifically, you must enable the "Transfer to PSTN" option in your SIP trunk settings to allow call transfers to external numbers or SIP endpoints. If this setting is not enabled, call transfer requests may fail.

Triggering a Call Transfer via API

You can initiate a call transfer by making an API request with the following payload:

Sample Request:

  • callId: The unique identifier of the ongoing call you want to transfer.
  • transferTo: The SIP URI or phone number to which the call should be transferred.
POST
|
https://api.videosdk.live/v2/sip/call/transfer
import fetch from 'node-fetch';
const options = {
method: "POST",
headers: {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"callId" : "712350ce-8fff-464d-b427-587bfb66636a",
"transferTo" : "+14155550123"
}),
};
const url= `https://api.videosdk.live/v2/sip/call/transfer`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
tip

Call transfer is supported for both inbound and outbound SIP calls, as long as the call is active and the transfer destination is reachable.

API Reference

Got a Question? Ask us on discord