The method initiate_call creates a new call in your Basix PBX.
ATTENTION: THIS METHOD IS DEPRECATED. USE METHODS call_user, call_group, call_external INSTEAD.
It will create a channel (originating leg) by calling a user or PSTN number. Then, when the channel gets answered it will be connected to any destination reachable by the PBX (destination can be another PSTN number, a user, a group, an extension number, etc).
Method parameters
Parameter Name | Description | Allowed Values | Default Value | Optional |
---|---|---|---|---|
user_name | user to call as originating leg. If parameter pstn_number is not present, by default, the call is sent to the user's terminals. | a user name | none | yes (but mandatory if parameter pstn_number is absent) |
pstn_number | pstn_number to call as originating leg. | a PSTN Number | none | yes (but mandatory if parameter user is absent) |
destination | destination to which originating leg will be connected to after answer | any valid destination in your PBX | none | no |
ani | specific ANI to be used when calling PSTN | any valid ANI in your PBX | none | yes |
group_name | if set, indicates this is a call made on behalf of a group and so, group settings like call recording and Zendesk Integration applies | a group name | none | yes |
Response
Response will return a json string with result_code=0 in case of success and a list of Channel UUIDs (one for each originating leg generated to call user's terminals or pstn_number) A non-zero result_code indicates an error and will be accompanied by a description of the error.
result_code | Description |
---|---|
0 | Success |
500 | Error. Details will be present in the json string. |
Examples using curl
Example 1: Calling user jessica's terminals and connecting her with 0312341234
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"user_name": "jessica", "destination": "0312341234"}'
{"result_code":0,"uuids":["ede7b23e-c172-445e-832e-963b11ba2b96","1c46fc4b-a42f-410e-82b5-11aa2a1f69fe"]}
Example 2: Calling user david at pstn_number="09011112222" and connecting him with user thomas
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"user_name": "david", "pstn_number": "09011112222", "destination": "thomas"}'
{"result_code":0,"uuids":["1678edb1-f399-49ea-ae95-ea1067acdfa8"]}
Example 3: Calling some customer at pstn_number="09012341234" and connecting him/her with sales
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"pstn_number": "09012341234", "destination": "sales"}'
{"result_code":0,"uuids":["7218edb1-f399-49ea-ae95-ea1067acd342"]}
Example 4: Calling some customer at pstn_number="09012341234" using specific ani="05011223344" and connecting him/her with user claire
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"pstn_number": "09012341234", "ani": "05011223344", "destination": "claire"}'
{"result_code":0,"uuids":["3cbb4b67-3521-4a41-8d47-a323a79cd4f3"]}
Example 5: Calling some customer at pstn_number="09012341234" and connecting him/her with extension 1111 (this can point to a Basix XML IVR for example):
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"pstn_number": "09012341234", "destination": "1111"}'
{"result_code":0,"uuids":["3cbb4b67-3521-4a41-8d47-a323a79cd4f3"]}
Example 6: Calling user helen's terminals under context of a group call with group="sales" and connecting her with 0312341234
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"user_name": "helen", "group_name": "sales", "destination": "0312341234"}'
{"result_code":0,"uuids":["ade7b23e-c172-445e-832e-963b11ba2b96","bc46fc4b-a42f-410e-82b5-11aa2a1f69fe"]}
Example 7: Failed request due to channel limit
$ curl -u 'DOMAIN_NAME:API_TOKEN' https://bcs.brastel.com/basix/api/initiate_call -X POST -H 'Content-Type: application/json' -d '{"user_name": "helen", "group_name": "sales", "destination": "0312341234"}'
{"result_code":500,"error":{"id":"channel_limit_reached"}}