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
Create Call Handling Rule is not working with Direct Numbers and in the API Reference
Tags: rest api
Apr 23, 2020 at 2:58pm   •   5 replies  •  0 likes
API Access

First off the API Reference for the Call Handling Rule does not work. If you try to follow the example that is on the API page you get this error:

Queue is allowed for Business Hours or Custom rule of department extension only

This is because the API Reference is always adding:

queue":{"holdTimeExpirationAction":"TransferToExtension"} or queue":{"holdTimeExpirationAction":"Voicemail"}

So I created my own Postman call and that worked fine. That is until I decided to not use a phone number in the calledNumbers field that was not on the Auto-Receptionist but was connected to a Site Extension.

Everytime I try to create a new rule with a number tied to the Site Extension (example. 18003271635) I get this error:

Parameter[calledNumbers.phoneNumber] value is invalid.

I have tried the number with a + at the front and everything else but I still get that error. When I try a number that is attached to the Auto-Receptionist it works fine (example. 18003338584+30001).

How do you link a Site Extension Called Number to a Custom Call Handling Rule? I can do it from the RingCentral App with no issue and I can pull that data from RingCentral using the API Get Call Handling Rule and see that the number is +18003271635 but that same number will not work in the Create Call Handling Rule. Here is my Postman Request:

POST https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/680723005/answering-rule

Headers:

Content-Type: application/json

Accept: application/json

Authorization: Bearer...

Body:

{"transfer":{"extension":{"id":"275553004"}},"type":"Custom","name":"TestRule","callers":[{"callerId":"1214"},{"callerId":"1847"}],"callHandlingAction":"TransferToExtension","calledNumbers":[{"phoneNumber":"18003338584+30001"},{"phoneNumber":"+18003271635"}],"enabled":false}
"errorCode": "InvalidParameter", "message": "Queue is allowed for Business Hours or Custom rule of department extension only", "errors": [ { "errorCode": "AWR-142", "message": "Queue is allowed for Business Hours or Custom rule of department extension only" } ] }

5 Answers
answered on Apr 27, 2020 at 8:42am  

I am lost now. You added the too much info which distracts rather than helps me to understand your problem.

Isn't this the key thing you were asking:

---

Queue is allowed for Business Hours or Custom rule of department extension only

This is because the API Reference is always adding:

  1. queue":{"holdTimeExpirationAction":"TransferToExtension"} or queue":{"holdTimeExpirationAction":"Voicemail"}

So I created my own Postman call and that worked fine. That is until I decided to not use a phone number in the calledNumbers field that was not on the Auto-Receptionist but was connected to a Site Extension.

Everytime I try to create a new rule with a number tied to the Site Extension (example. 18003271635) I get this error:

  1. Parameter[calledNumbers.phoneNumber] value is invalid.

---

I also have a look at your sandbox account and could not find any rule with the name "Chicago Area". Maybe you have deleted it. But those called numbers from the list are company numbers. They are not assigned to an extension and I don't know for which extension you were trying to setup a call handling rule.

I see from your sandbox a bunch of test rules and non of them are set with called number condition


 0
answered on Apr 26, 2020 at 10:06pm  

Thanks for the reply @Phong Vu. The issue I am seeing is not the Queue Member (that is working fine and I see the Extension ID) it is with the Called Number (number that was called to get into Ring Central).

So I have 2 Phone Numbers that I can call that will take me into the Ring Central System. When I set this up in Ring Central everything works fine. I then download the body of the message from Ring Central with the API and I get this:

{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule?view=Detailed&page=1&perPage=100",
"records": [
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule/41508005",
"id": "41508005",
"type": "Custom",
"name": "Chicago Area",
"enabled": true,
"callers": [
{
"callerId": "1312"
},
{
"callerId": "1512"
},
{
"callerId": "1847"
}
],
"calledNumbers": [
{
"phoneNumber": "+14703271635"
},
{
"phoneNumber": "+14703338584"
},
{
"phoneNumber": "+15877604199"
}
],
"callHandlingAction": "TransferToExtension",
"transfer": {
"extension": {
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680721005",
"id": "680721005"
}
}
}
],
"paging": {
"page": 1,
"totalPages": 1,
"perPage": 100,
"totalElements": 3,
"pageStart": 0,
"pageEnd": 2
},
"navigation": {
"firstPage": {
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule?view=Detailed&page=1&perPage=100"
},
"lastPage": {
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule?view=Detailed&page=1&perPage=100"
}
}
}


If I then take that same information and make a Create Call Handling Rule with the same data it fails on Called Numbers with the error:


  
  1. Parameter[calledNumbers.phoneNumber] value is invalid.

I can confirm that the number exists and shows up in the Get Company Phone Number List call with no issues. The phone numbers also work fine if I am doing an update and not a create. It is only failing on the Create Call Handling Rule. I am just not sure what else it might want so the call will work.


**UPDATE**

I also tried using the Phone Number ID to see if that made any difference. It did not work.

{ "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule?view=Detailed&page=1&perPage=100", "records": [ { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule/41508005", "id": "41508005", "type": "Custom", "name": "Chicago Area", "enabled": true, "callers": [ { "callerId": "1312" }, { "callerId": "1512" }, { "callerId": "1847" } ], "calledNumbers": [ { "phoneNumber": "+14703271635" }, { "phoneNumber": "+14703338584" }, { "phoneNumber": "+15877604199" } ], "callHandlingAction": "TransferToExtension", "transfer": { "extension": { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680721005", "id": "680721005" } } }, { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule/business-hours-rule", "id": "business-hours-rule", "type": "BusinessHours", "enabled": true, "callHandlingAction": "TransferToExtension", "transfer": { "extension": { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/274535004", "id": "274535004" } } }, { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule/243517004", "id": "243517004", "type": "Custom", "name": "Dallas Area", "enabled": true, "schedule": { "weeklyRanges": { "monday": [ { "from": "00:00", "to": "00:00" } ], "tuesday": [ { "from": "00:00", "to": "00:00" } ], "wednesday": [ { "from": "00:00", "to": "00:00" } ], "thursday": [ { "from": "00:00", "to": "00:00" } ], "friday": [ { "from": "00:00", "to": "00:00" } ], "saturday": [ { "from": "00:00", "to": "00:00" } ], "sunday": [ { "from": "00:00", "to": "00:00" } ] } }, "callers": [ { "callerId": "1214" } ], "calledNumbers": [ { "phoneNumber": "+14703338584" }, { "phoneNumber": "+15877604199" } ], "callHandlingAction": "TransferToExtension", "transfer": { "extension": { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680720005", "id": "680720005" } } } ], "paging": { "page": 1, "totalPages": 1, "perPage": 100, "totalElements": 3, "pageStart": 0, "pageEnd": 2 }, "navigation": { "firstPage": { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule?view=Detailed&page=1&perPage=100" }, "lastPage": { "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/268167004/extension/680723005/answering-rule?view=Detailed&page=1&perPage=100" } } }


 0
answered on Apr 27, 2020 at 2:05pm  

I recommend you to send your question on a support ticket where the developer support team can help you better and keep your account information private.


 0
answered on Apr 27, 2020 at 12:16pm  

@Phong Vu OK let me just focus on the main issue I am having. So first off I think you are looking at the wrong DEV environment. I have 2 Applications and I am using the WP-Routing_Dev application


If I go into the application I see the rules which is under the Routing Site 30001 extension:

If I edit that rule I see the 2 numbers that I added:

Now if I go into postman and decide to make a new Rule in the Site with the Extension 30001 here is the body of the Postman call

{"transfer":{"extension":{"id":"275553004"}},"type":"Custom","name":"JRYTest","callers":[{"callerId":"1800"},{"callerId":"1936"}],"callHandlingAction":"TransferToExtension","calledNumbers":[{"phoneNumber":"+14703338584"}],"enabled":false}

The error I get is this:

{
"errorCode": "InvalidParameter",
"message": "Parameter [calledNumbers.phoneNumber] value is invalid.",
"errors": [
{
"errorCode": "CMN-101",
"message": "Parameter [calledNumbers.phoneNumber] value is invalid.",
"parameterName": "calledNumbers.phoneNumber"
}
],
"parameterName": "calledNumbers.phoneNumber"
}

 0
answered on Apr 26, 2020 at 8:38am  

Make sure that the call queue must have the extension as its queue member.

In your case, this call queue with this direct number 18003338584, must have the extension (extension id 680723005) as its queue member.


 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