question

Pawel Oltuszyk avatar image
Pawel Oltuszyk asked Phong Vu answered

Call is not forwarded when using the RC API

Hi I created my own app for forwarding the call. Whenever I make a call to the specific number I get info send to the webhook url. I do process this info and then forward the call. Now, When I make a call to that specific number I get forwarded, everything works as expected, however when I make a next call after the first one, in a short period of time the forwarding does not work. I need to wait some time and the when I try the same thing, the cycle repeats.


I managed to record the error.ring-cenral-error.png

Can you please help me understand it.

call forwarding
2 comments
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

How long is that short period you have to wait until successfully get your next call forwarded? Can you reproduce the problem consistently with the same calling pattern?

0 Likes 0 ·

The calling pattern is always the same. I have not measured the exact times, however the time between the calls is less than 15 sec and the time between the "calling cycles" needs to be few minutes

0 Likes 0 ·

1 Answer

Phong Vu avatar image
Phong Vu answered

This is weird. I test over and over again to forward incoming calls to an extension and it works every time. Here is how I handle an incoming call to extension 102, forward the call to extension 103 using the forward API in Node JS.

subscription.on(subscription.events.notification, function(msg)
    console.log("======");
    if (msg.event.indexOf('telephony/sessions') > 0){
      var body = msg.body
      //var callerNumber = body.parties[0].from.phoneNumber
      if (body.parties[0].direction == "Inbound" && body.parties[0].status.code == "Setup"){
        console.log(JSON.stringify(msg));
        forwardCallByExtensionNumber(body, '103')
        }
    }
});

async function forwardCallByExtensionNumber(call, extensionNumber){
  var endpoint = '/restapi/v1.0/account/~/telephony/sessions/'
  endpoint += call.telephonySessionId
  endpoint += `/parties/${call.parties[0].id}/forward`
  console.log(extensionNumber)
  console.log(endpoint)
  try{
    var resp = await platform.post(endpoint, {
      extensionNumber : extensionNumber
    } )
    var jsonObj = await resp.json()
    console.log(JSON.stringify(jsonObj))
    console.log("FORWARDED")
  }catch(e){
    console.log(e)
  }
}
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys