question

tim-falkins15666 avatar image
tim-falkins15666 asked ·

Account Telephony Sessions Event in Sandbox account?

Any way to get access to the account telephony sessions event in the sandbox account? My company is evaluating moving to RingCentral and I'm told this event would let us monitor all incoming calls from certain numbers, apply our own logic to those calls and reroute as necessary. The only issue is I can't evaluate our ability to do this since this particular event is not available in my sandbox account.
General Topic
1 |1000 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.

Phong Vu avatar image
Phong Vu answered ·
Hi Tim,

Please read this blog and let me know if you have further questions. Basically, what you want is completely doable with our Telephony APIs.

As for testing on your sandbox with multiple users, goto https://service.devtest.ringcentral.com, login with the main company number (an admin user) and add more users to your sandbox account, remember to add direct phone number to each extension (user) so you can test with those phone numbers.

Hope this helps!
+ Phong
1 |1000 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.

tim-falkins15666 avatar image
tim-falkins15666 answered ·
Thaks, Phong, but it looks like your blog post referred to determining presence. What I need to do is decide where to route incoming calls from a handful of 800#s to various ring groups based on the area code and prefix (and maybe the entire 10-digit number in some cases) of the caller.

We already have the logic to handle this decision in a database function, so I'm looking to ensure that the RC event exists that can be subscribed to in order to monitor every inbound call, pass the call parameters to our database function, and ultimately return the correct ring group for routing the call. Does that make sense? Is the /restapi/v1.0/account/{accountId}/telephony/sessions event the right one to use in this case?
12 comments
1 |1000 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.

Hi Tim,

Yes, it is about presence but there is a part I mentioned about the telephonyStatus, where you can detect incoming and active calls. In fact, that is just a starting point for you to learn the basic thing about how to use RingCentral push notification.

For your particular purpose, you would end up at using several APIs and the TelephonySession event might be the one you need. Then use the Active Call Control to manage and control the call.

Please read this blog to see how Call Control API works.

Let me know if you have further questions.
0 Likes 0 ·
OK. But for more clarity on my original post, I'm getting an error when trying to use the telephony/sessions event. "Required application permission [TelephonySessions] is missing." This permission isn't available withi the sandbox environment. When I posted on Github, I was told I'd need to contact  devsupport@ringcentral.com, but the person helping me suggested I post here on this forum.
0 Likes 0 ·
What is your sandbox account's main company number?
0 Likes 0 ·
Done! You should have access to use beta API such as the telephony session and call control APIs.
0 Likes 0 ·
Show more comments
Phong Vu avatar image
Phong Vu answered ·

Hi Ivie,

Welcome onboard!

The Call Control API is publicly accessible now and the TelephonySession is no longer needed.

All you need is to login your developer account at developers.ringcentral.com, open the app and add the CallControl permission to the app.

Let me know if you need further supports

1 |1000 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.

Ivie O avatar image
Ivie O answered ·

Thank you, Phong, I thought as much because the subscription code ran without error. Now, just trying to figure out how to setup code to listen for incoming call event.

3 comments
1 |1000 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.

Can you please help with this?

0 Likes 0 ·

What programming language are you working with? Do you want to use PubNub or Webhooks notification?

0 Likes 0 ·

C#. Both please

0 Likes 0 ·
Ivie O avatar image
Ivie O answered ·

C#. Both please

1 |1000 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.

Phong Vu avatar image
Phong Vu answered ·

For PubNub C# please see this quick start code.

For Webhooks C#, see this quick start code.

In both cases, change the event filter to receive presence event as follow:

eventFilters = new[] { "/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true"}

3 comments
1 |1000 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.

Thank you, Phong. Looks like all I needed was the timer to complete the pub-sub set up. The debugger seems to run through the code at least once and on the second round of stepping through, I get an error (see attached); I wonder if that's because the call cycle ended and the session is no longer valid? Also, it does not appear that the call actually forwarded. Any thoughts?

Code:

0 Likes 0 ·
rcerror.png (31.2 KiB)
1569268574870.png (100.8 KiB)
rcerror1.png (197.1 KiB)

I found the issue; I had:

var partyId = jObject.body.activeCalls[0].id.ToString();

instead of

var partyId = jObject.body.activeCalls[0].partyId.ToString();


0 Likes 0 ·

Not sure what you meant about using a timer to complete pubnub setup. This while loop keep your process running until you kill it

while (true)
{
  Thread.Sleep(5000);
}

But be aware of PubNub subscription will expire when the access token (used in the SDK) expires. You will need to call the AutoRefresh() function turn on auto refresh from the C# SDK.

However, if you expect your app and the notification running for weeks or months, I recommend to use Webhooks notification.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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