JSON API » calls » calls/make

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.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
stypeString"phone" to make first call to a telephone line, empty string to make first call to a number.RecommendedEmpty string.
snumberStringTelephone line or number to make first call to.Yes
ctypeStringDestination type to forward call to when first call is answered.RecommendedEmpty string.
cnumberStringNumber to forward call to when first call is answered.Yes
cdialplanStringDialplan of the number to forward to. Currently only "auto" is supported, to convert number to snumber's dialplan.No
cardStringCard to bill call to. Empty string for none. If in another customer, the customer must also be set.NoEmpty string.
customerIntegerCustomer to make call as.NoCustomer of authentication user.
answer1Integer1 to request first call auto-answers, 0 not to.No0
answer2Integer1 to request second call auto-answers, 0 not to.No0
callerid1StringCallerid on first call.NoEmpty string.
callerid2StringCallerid on second call.NoEmpty string.
recordgroupIntegerID of record group to record call. 0 for none.No0
screen1Integer1 to set call screening on first call, 0 not to.No0
screen2Integer1 to set call screening on second call, 0 not to.No0
warn1Integer1 to play cutoff warning on first call, 0 not to.No1
warn2Integer1 to play cutoff warning on second call, 0 not to.No1
delayIntegerWait this number of seconds before making the call.No0
waitIntegerWait 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.No0
noforwardsInteger1 to prevent call forwards within Enswitch on no answer, 0 not to.No0

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

Responses

CodeDescription
200Call successfully requested, and the machine, server and callid are being returned.
204Call successfully requested, but the call machine, server and callid were either not requested or not available.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
403Your 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://enswitch.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://enswitch.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://enswitch.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 successfully returned, allowing the call to be tracked and manipulated

http://enswitch.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" }, }

Change history

VersionChanges
3.13Function added.