I've set up an application that subscribes to the account telephony webhook, looks up information in our database about the caller, and then attempts to route the call to the person the caller is trying to reach by forwarding the call to that Ring Central user's direct phone number. I am using the .NET SDK. Below is the method that runs the call forwarding action. This all works as expected in the sandbox environment, however when I promote it to production I am getting some very unexpected behavior and was hoping for some help to figure out why.
1) On the sandbox environment, when the call is forwarded to a direct line, a new call with a different telephonySessionId is created and the account telephony webhook is pinged multiple times with this new call and the forwarded call rings the soft phone associated with the the direct line
2) On production, when the call is forwarded to a direct line of a Ring Central extension, the phone just rings and rings and no new phone call is pinging the account telephony webhook. The soft phone associated with the direct line of the forwarded call does not ring. After several minutes, a recording says this call could not be connected and hangs up. I can confirm that a properly formatted non null phone number is being used and there are no exceptions being generated in the code.
3) On production, if instead of forwarding the call to the direct line of a Ring Central extension, I instead forward it to an external number, for instance, my cell phone. It works as expected. That is to say the behavior on production matches the behavior on sandbox and my cell phone rings.
Really the only difference between our production and sandbox environments is that we leverage call queues and ring groups in production and we don't in sandbox. Could this be the issue?
Thanks!
public async Task<bool> ForwardPhoneCall(string phoneNumber, string userName, string firmId, string telephonySessionId, string partyId, string toNumber, ForwardedCall forwardedCall)
{
try
{
if (phoneNumber != null)
{
RingCentralCredentials creds = await GetRingCentralCredentials(firmId);
ForwardTarget forwardTarget = new ForwardTarget() { phoneNumber = phoneNumber.FormatPhoneNoSpaces() };
var rc = new RestClient(creds.clientID, creds.clientSecret, creds.serverURL);
rc.token = await Authorize(creds, rc, firmId);
await rc.Restapi().Account().Telephony().Sessions(telephonySessionId).Parties(partyId).Forward().Post(forwardTarget);
return true;
}
return false;
}
catch(Exception ex)
{
throw;
}
}