Call Transfer
Call transfer moves an active leg into a new conversation context. In client callbacks, callId remains stable while conversationId changes.
Common use cases include contact center routing and IVR handoff to agents.
Client Transfer Event — onCallTransfer
Copy
client.on('callTransfer', (callId, newConversationId) => {
console.log(
`Call ${callId} was transferred to a new conversation ${newConversationId}`
);
});
Copy
client.setCallTransferListener { call, conversationId ->
println("Received Call Transfer for call: $call into the conversation: $conversationId")
}
Copy
client.setCallTransferListener((call, conversationId) -> {
System.out.println("Call " + call + " was transferred to conversation " + conversationId);
return null;
});
Copy
class CallTransferExampleDelegate: NSObject, VGVoiceClientDelegate {
func voiceClient(_ client: VGVoiceClient, didReceiveCallTransferForCall callId: VGCallId, withConversationId conversationId: VGConversationId) {
print("call: \(callId) has been transferred to conversation: \(conversationId)")
}
func voiceClient(_ client: VGVoiceClient, didReceiveHangupForCall callId: VGCallId, withQuality callQuality: VGRTCQuality, reason: VGHangupReason) {}
func voiceClient(_ client: VGVoiceClient, didReceiveInviteForCall callId: VGCallId, from caller: String, with type: VGVoiceChannelType) {}
func voiceClient(_ client: VGVoiceClient, didReceiveInviteCancelForCall callId: VGCallId, with reason: VGVoiceInviteCancelReason) {}
func client(_ client: VGBaseClient, didReceiveSessionErrorWith reason: VGSessionErrorReason) {}
}
Copy
- (void)voiceClient:(VGVoiceClient *)client didReceiveCallTransferForCall:(VGCallId)callId withConversationId:(NSString *)conversationId {
NSLog(@"Call %@ has been transferred to conversation %@", callId, conversationId);
}
State Expectations
callId: unchangedconversationId: updated to destination conversation- media session: continues through transfer flow
Transfer NCCO
The example below illustrates the required NCCO structure. Your actual implementation will vary based on your backend language and framework.
Copy
const transferNcco = [
{
action: 'transfer',
conversation_id: 'CON-destination-conversation-id'
}
];
res.json(transferNcco);
Reference: NCCO transfer action