Skip to main content

I'm implementing a RingCentral integration that requires starting calls from a server-side application and later transferring those active calls to a client-side web application. Specifically:

  1. I use the server-side softphone JS implementation (ringcentral-softphone-js) to initiate outbound calls

  2. When needed, I want to transfer the active call to a WebPhone instance running in a React client application

My research indicates RingCentral has a built-in "Switch call to this device" feature, which appears to accomplish this type of transfer using SIP protocol mechanisms rather than the REST API.

 

Technical Research So Far

I've analyzed the SIP traffic during a "Switch call to this device" operation and found it sends a specialized SIP INVITE with a Replaces header:

INVITE sip:+15551234567@sip.ringcentral.com SIP/2.0
Via: SIP/2.0/WSS xxxx.invalid;branch=z9hG4bKxxxxxxx
Max-Forwards: 70
To: <sip:+15551234567@sip.ringcentral.com>
From: <sip:15551234567*101@sip.ringcentral.com>;tag=xxxxxxxx
Call-ID: xxxxxxxxxxxx
CSeq: 8607 INVITE
Replaces: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;to-tag=xxxx-xxxx-xxxx;from-tag=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RC-call-type: replace
p-rc-capabilities: promote-rcv; e2ee
P-rc-endpoint-id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Client-id: xxxxxxxxxxxx
P-Asserted-Identity: sip:15551234567*101@sip.ringcentral.com
P-rc-country-id: 1
Contact: <sip:xxxxxxxx@xxxx.invalid;transport=ws;ob>
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound
User-Agent: RingCentral WebPhone
Content-Type: application/sdp
Content-Length: 1415

>SDP payload omitted]

 

I've also checked the REST API for call transfer, but found that /restapi/v1.0/account/~/telephony/sessions/${sessionId}/parties/${partyId}/transfer does not accept a deviceId parameter as needed for this use case.

 

Question:

What are the possible ways to transfer call from softphone to webphone like in my case ?

 

Technical Environment

Any code examples, documentation references, or implementation guidance would be extremely helpful. I believe this functionality should be possible given the "Switch call to this device" feature exists natively, but I need guidance on programmatically implementing it in custom applications.

Thank you in advance for your help!

 

First of all, when you login your web phone, you should find the phone number of the user. Copy that phone number

 

Then when you have a connected call session from the soft-phone (your server phone), call the transfer function to transfer the call to that user phone number.

async makeCall function(phoneNumber){
const callSession = await softphone.call(phoneNumber);

callSession.once('answered', async () => {
// set delay and transfer this call
console.log("Call connected. Transfer after 10 secs")
setTimeout(function(){
console.log("Transferring call")
callSession.transfer("+1650XXXXX"); // phone number shown in the web phone!
}, 10000)
});

callSession.once('disposed', () => {
console.log("Call hanged up")
});
}

 


Reply