Call allows you to initiate an outbound call to any device or endpoint that FreeSWITCH supports like SIP phone, Regular Phone or even GTalk.

Call Request URL

To make a call, make an HTTP POST to the below URL with the required parameters:

http://{BASEURL}/{ApiVersion}/Call/

POST Parameters

Required Parameters

You must POST the following parameters:

Parameter Description
From The phone number to use as the caller id (with the country code). E.g. For USA 15551234567
To The number to call (regular phone numbers must be prefixed with country code but without the ‘+’ sign) E.g., For USA 15557654321.
AnswerUrl The fully qualified URL that Plivo will request RESTXML from, when the call connects. This will be used to control the connected call, as is the case for inbound calls. Parameters mentioned here would be sent along.
Gateways This should be valid FreeSWITCH gateway strings separated by comma. If multiple gateways are specified, all the gateways will be tried sequentially for failover for the specified number of retries. E.g. 'user/,sofia/gateway/PSTNgateway1/,sofia/gateway/PSTNgateway2/'.
Optional Parameters

You may POST the following parameters:

Parameter Description
CallerName Caller name to use with the call.
HangupUrl The URL that will be notified by Plivo when the call hangs up. HangupCause will be sent to the URL as a POST parameter along with other parameters.
RingUrl The URL that Plivo will notify when the call starts ringing. RequestUUID corresponding to the API request sent earlier and CallUUID will be sent along with the other parameters.
ExtraDialString E.g. "bridge_early_media=true,hangup_after_bridge=true" This will add these channel variables to the dialstring in FreeSWITCH while dialing a number. You can use any channel variables supported by FreeSWITCH for granular control. Please refer to this link for more details
GatewayCodecs Through this parameter you can choose the valid codec(s) to be used for each FreeSWITCH gateway. E.g.'PCMA,PCMU','G729,PCMU','PCMA,G729'.
GatewayTimeouts As the name suggests, gatewayTimeouts indicates the timeouts (in seconds) for each FreeSWITCH gateway. E.g "10,10,10". Here Plivo will use 10 seconds timeouts while trying to dial a call through each of the three gateways..
GatewayRetries The number of times each of the gateways must be tried. E.g. "2,1,1" Here gateway 1 will be tried twice and others gateways will be tried once each.
SendDigits The SendDigits parameter tells Plivo to play DTMF tones when the call is answered. This is useful when dialing a phone number and an extension. Plivo will dial the number, and when the automated system picks up, send the DTMF tones to connect to the extension. E.g. wwww2410 In this case, we want to dial the 2410 extension after the call is connected. We want to wait before sending the extension, so we add a few leading ‘w’ characters.
Each 'w' character waits 0.5 seconds instead of sending a digit.
Each 'W' character waits 0.5 seconds instead of sending a digit.
You can also add the tone duration in ms by appending @duration after string (default duration is 2000 ms).
Eg. 1w2w3@1000
SendOnPreanswer If set to 'true', SendDigits is executed when called party is in early media instead of answer state. (default 'false')
TimeLimit This parameter will schedule the call for hangup at a specified time after the call is answered. It should be an integer >0 in seconds.
HangupOnRing This parameter will schedule the call for hangup at a specified time after the call starts ringing. It should be an integer >=0 in seconds.

Response Parameters

When you initiate a RESTAPI, Plivo responds with the standard parameters as mentioned here. Along with that the following additional parameters are sent:

  • RequestUUID: A unique identifier for this particular API request.

Comments are closed.