question

API Access avatar image
API Access asked ·

Create Call Handling Rule is not working with Direct Numbers and in the API Reference

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" } ] }

call handing rule api
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 ·

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.

Share
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.

API Access avatar image
API Access answered ·

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"; } } }

Share
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 ·

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


Share
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.

API Access avatar image
API Access answered ·

@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"
}

1588014409635.png (38.2 KiB)
1588014602795.png (38.7 KiB)
1588014692568.png (21.5 KiB)
Share
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 ·

I recommend you to send your question to devsupport@ringcentral.com where they can help you better and keep your account information private.

Share
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.

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.