Make a Call

Makes a call to a telephone line or number. When it answers, makes a second call to a number, bridging both calls together. When calling numbers, they can be any destination dialable by the customer. The actual request is asynchronous, and may take a second or two after the function returns, unless wait is specified.

Input parameters

Requires authentication and the actions or panel role privileges.

Name Type Description Required Default value
auth_username String Authentication username. Yes
auth_password String Authentication password. Yes
stype String “phone” to make first call to a telephone line, empty string to make first call to a number. Recommended Empty string.
snumber String Telephone line or number to make first call to. Yes
ctype String Destination type to forward call to when first call is answered. Recommended Empty string.
cnumber String Number to forward call to when first call is answered. Yes
cdialplan String Dialplan of the number to forward to. Currently only “auto” is supported, to convert number to snumber’s dialplan. No
card String Card to bill call to. Empty string for none. If in another customer, the customer must also be set. No Empty string.
customer Integer Customer to make call as. No Customer of authentication user.
answer1 Integer 1 to request first call auto-answers, 0 not to. No 0
answer2 Integer 1 to request second call auto-answers, 0 not to. No 0
callerid1 String Callerid on first call. No Empty string.
callerid2 String Callerid on second call. No Empty string.
recordgroup Integer ID of record group to record call. 0 for none. No 0
screen1 Integer 1 to set call screening on first call, 0 not to. No 0
screen2 Integer 1 to set call screening on second call, 0 not to. No 0
warn1 Integer 1 to play cutoff warning on first call, 0 not to. No 1
warn2 Integer 1 to play cutoff warning on second call, 0 not to. No 1
delay Integer Wait this number of seconds before making the call. No 0
wait Integer Wait this number of second after submitting the API request for the call to made, and return the call machine, server and callid if known. 0 to disable. No 0
noforwards Integer 1 to prevent call forwards within VProvider on no answer, 0 not to. No 0

If both delay and wait are used, wait should be greater than the delay.

Responses

Code Description
200 Call successfully requested, and the machine, server and callid are being returned.
204 Call successfully requested, but the call machine, server and callid were either not requested or not available.
400 Invalid input parameters specified. Check the key and message fields for more details.
401 The authentication details provided are invalid.
402 Your role does not allow this.
403 Your rate plan does not allow this.

Data returned

If the wait parameter is specified, and the machine, server and callid of the call become available during that time, they will be returned. Otherwise, no data is returned.

Example: Make a call to a telephone line, then connect it to another telephone line in the same customer

http://domain.example.com/api/json/calls/make/?auth_username=user;auth_password=password;stype=phone;snumber=1234567;cnumber=1234568

{ “responses”:[ { “code”:”204″, “key”:””, “message”:”OK” } ] }

Example: Make a call to a telephone line, then connect it to an external number

http://domain.example.com/api/json/calls/make/?auth_username=user;auth_password=password;stype=phone;snumber=1234567;cnumber=2125551234

{ “responses”:[ { “code”:”204″, “key”:””, “message”:”OK” } ] }

Example: Make a call to an external number, then connect it to a feature code that routes to a queue

http://domain.example.com/api/json/calls/make/?auth_username=user;auth_password=password;stype=;snumber=2125551234;cnumber=100

{ “responses”:[ { “code”:”204″, “key”:””, “message”:”OK” } ] }

Advanced example: With wait, and machine, server and callid sucessfully returned, allowing the call to be tracked and manipulated

http://domain.example.com/api/json/calls/make/?auth_username=user;auth_password=password;stype=phone;snumber=1234567;cnumber=2125551234;wait=5

{ “responses”:[ { “code”:”200″, “key”:””, “message”:”OK” } ], “data”:{ “machine”:1, “server”:”asterisk01″, “callid”:”1234567890.123456″ }, }