What is Programmable Routing?
Programmable Routing makes it easy for you to add voice-over-IP (VoIP) routing logic into your applications quickly.
A simple if else statement can re-route millions of voice calls from one carrier to another in real-time, it also allows you to build LCR (Least Cost Routing) depending on which carrier is offering the lowest price for the dialed number or block service providers as their ASR or ACD metrics drop to a specific destination.
The Problem:
Lets say Uber is using programmable voice provided by one of the popular CPaaS providers today to connect riders with drivers using programmable voice and suddenly the carrier used by the CPaaS provider behind the scenes is having technical difficulties to connect the calls, this can potentially effect millions of users ride sharing experience and the app developer “Uber” will have no option but to switch the CPaaS provider completely until the issue is resolved.
Programmable Routing by powered by TelecomsXChange and Restcomm API allows the app developer to change carriers terminating the voice calls in realtime as soon as a problem is detected right from the application level, the developer can even build their own carrier testing tool right into their application and switch back routing when issue has been resolved.
How it works ?
In order to use Programmable Routing its very simple, you only need to have two things for the magic to happen:
Now click on Add New to whitelist your Restcomm IP-Address on TelecomsXChange:
Finally you will need to subscribe to Termination providers (e.g TATA, AirTel, Verizon, IDT etc..) each carrier you subscribe (purchase route) you’ll receive an email notification with Tech Prefix to use in order to route the calls to, e.g TATA Tech prefix is 32270# while AirTel is 73297#, don’t worry we’ll come back to tech prefix in few minutes.
Subscribing to carrier’s routes is very simple, for example this blog post shows you how to subscribe to AirTel , once your done subscribing you’ll be able to send calls to AirTel immediately from your Restcomm Cloud.
Initiating Calls (Restcomm API):
Get your account SID and account token from Restcomm Cloud Portal:
now as per Restcomm Voice API documentation, to initiate voice calls via API, use below template and replace your account Sid and Token from the ones you have retrieved from your Restcomm Account.
curl -X POST https://<your account sid>:<your account token>@cloud.restcomm.com/
As we discussed before TelecomsXChange requires a special tech prefix to know which carrier to route the calls to, at this moment we’ll be using AirTel to terminate the call which requires us to send a tech prefix 73297# before the country code and telephone number, so to achieve that in the To parameter , we have to enter To=73297%23 which equals to 73297# , so if we’re calling 195412350000 it’ll look like this:
To is the number we’re dialing to)
To=73297%2319541235001.
From is the number we’re dialing from “Caller ID” The %2b represents the + sign before the number)
From=%2b19542405000.
The complete API request will look like this now:
curl -X POST https://ACcc38b3e0fcf3d2654cd73e210f542233ce:13dd0e03b368f49586428e7a5a3sc49a@cloud.restcomm.com/restcomm/2012-04-24/Accounts/ACcc38b3e0fcf3d2654cd73e210f5477ce/Calls.json -d “From=%2b19542405000” -d “To=73297%2319541235001” -d “Url=https://cloud.restcomm.com/restcomm-rvd/services/apps/AP1c9836a2f3d04e72a74f1e277d232e42/controller”
If you execute the API call, the call is now routed via TelecomsXChange to AirTel, if you want to switch calls instantly to another carrier for whatever reason you just need to change the Tech Prefix before the telephone number, e.g to send the same call to TATA instead of Airtel the To field will look like this“To=32270%2319541235001”.
You have just re-routed traffic from one carrier to another right from your code 🙂 , You can now build your own routing policies and logic right from your text editor.
if you still have balance with Twilio or like their rates to a specific destination you can still route traffic to Twilio via TelecomsXChange using the Tech prefix 32123#, “To=32123%2319541235001”.
If you have any questions on how to use Restcomm with TelecomsXChange please email support@telecomsxchange.com for instant support.
P.S: Video Tutorial Coming Soon.
You must be logged in to post a comment.