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
How to identify to which queue a call belongs after is forwarded from an IVR
Tags: ivr, rest api, call forwarding, sending sms
Aug 22, 2023 at 9:50am   •   1 replies  •  0 likes
Cesar Labrador

Caller's calls are received by an IVR menu first, and based on the selected option, their call gets routed to the corresponding extension. I set a webhook to listen to 'telephony events', so based on which extension is hit, an automated SMS is sent to the caller. Each extension has attached a different template message for each queue.

As I am handling calls for multiple clients, the cases are common but I cannot identify which queue was hit by the caller at the beginning to send the caller the right message, since the text template will change depending on the client (queue) that is trying to be contacted.


1 Answer
answered on Aug 22, 2023 at 12:57pm  

I need to clarify your question.

"Caller's calls are received by an IVR menu first, and based on the selected option, their call gets routed to the corresponding extension."

Do you mean the "corresponding call queue (extension)", right? E.g press 1 => route to "Queue 1"; press 2 => route to "Queue 2" etc.

And,

"Each extension has attached a different template message for each queue"

Do you mean "each call queue" has attached a different template message for SMS auto reply?

And,

"As I am handling calls for multiple clients ..."

Do you mean "multiple users" under the same RingCentral account or "multiple users" under different RingCentral accounts?

You did not mention which telephony session event filter do you use. But here is the trick to identify which call queue is having an incoming call (regardless of via an IVR or a direct call)

Provided that you subscribe for a company (account level) telephony session event notification

'/restapi/v1.0/account/~/telephony/sessions'

Then you would get these events after the call is routed to a call queue

{
    "event": "/restapi/v1.0/account/809646xxx/extension/62284877056/telephony/sessions",
    ...
    "body": {
      "sequence": 6,
      "telephonySessionId": "s-a0d17e304ee1ez18a1e628a5fzcdfd0840000",
      ...
      "parties": [
        {
          "accountId": "809646xxx",
          "extensionId": "62284877056",
          "id": "p-a0d17e304ee1ez18a1e628a5fzcdfd0840000-3",
          "direction": "Inbound",
          "to": {
            "phoneNumber": "+1209788xxxx",
            "name": "Paco IVR",
            "extensionId": "62284877056"
          },
          "from": {
            "phoneNumber": "+1650224xxxx",
            "name": "WIRELESS CALLER"
          },
          "status": {
            "code": "Setup",
            "rcc": false
          },
          ...
        }
      ],
      "origin": {
        "type": "Call"
      }
    }
}
  
{
    "event": "/restapi/v1.0/account/809646xxx/extension/62284877056/telephony/sessions",
    ...
    "body": {
      "sequence": 7,
      "telephonySessionId": "s-a0d17e304ee1ez18a1e628a5fzcdfd0840000",
      ...
      "parties": [
        {
          "accountId": "809646xxx",
          "extensionId": "62284877056",
          "id": "p-a0d17e304ee1ez18a1e628a5fzcdfd0840000-3",
          "direction": "Inbound",
          "to": {
            "phoneNumber": "+1209788XXXX",
            "name": "Paco IVR",
            "extensionId": "62284877056"
          },
          "from": {
            "phoneNumber": "+1650224XXX",
            "name": "Demo Queue - WIRELESS CALLER"
          },
          "status": {
            "code": "Proceeding",
            "rcc": false
          },
          ...
        }
      ],
      "origin": {
        "type": "Call"
      }
    }
}

The extension id in the parties array is the extension id of the call queue that receiving the incoming call. The from.phoneNumber is the number of the caller. So, map the call queue extension id to the message template and you can get the right template for each call queue and reply to the from.phoneNumber.


 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