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