News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Call is not forwarded when using the RC API
Tags: call forwarding
Jun 22, 2021 at 2:27am   •   2 replies  •  0 likes
Pawel Oltuszyk

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.

on Jun 22, 2021 at 11:32am   •  0 likes

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?

on Jun 23, 2021 at 12:16am   •  0 likes

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

1 Answer
answered on Jun 23, 2021 at 10:25am  

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)
  }
}

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us