Voice Callback via API
API can be used in the applications like outbound call centers and callback
So far we have discussed simple Voice call API use case: sending a call to remote party and playing either prerecorded or text to speech message or a combination of both. Now we will discuss a more advanced option: setting up a two-leg call between two parties. This setup can be used for a range of applications, like:
- call back systems,
- outbound call centers
The idea behind this API is following:
- an external application sends API request containing addresses (or numbers) of two remote users;
- Depending on the request, the parties are called in sequence or simultaneously
- When the calls are established, the calls are interconnected together, and the speech is passed both ways between sides.
As mentioned above, it can be used in call back applications and call centers.
In case of callback, the trigger can be any kind, either inbound call, or data packet, or SMS, as described in this post. It is not part of this API, and therefore not discussed here. What is important that it should be able to do proper authentication and produce RESTful API request to initiate a call back.
In case of outbound call center (contact center), the application which runs call center process (a dialer) produces API request to initiate many callback calls. The A-leg in this case is client (remote side), and B-side – an agent. It can be set up in a way that agent is called only when A-leg is connected or vice versa according to requirement.
Here is the example callback API call which connects caller with number 1000123
as A-leg and caller with number 1000125
as B-leg:
POST /voice/call/callback
{
"
leg_A": {
"to": "
1000123
",
"from": "
1000125
"
}
,
"leg_B": {
"to": "
1000125
",
"from": "
1000123
"
}
}
As you can see above, it is very simple example. You can use more attributes, as discussed here and here for each call leg to have them routed as required. Also you can set arbitrary caller ID. In the example above each leg receives other legs destination as caller ID, as it is used most frequently.