Skip to main content

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.

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?


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

Reply