Manage callback calls
Это содержимое пока не доступно на вашем языке.
A callback request makes the switch call a number first and then continue the session. With make2WayCallback the switch calls party A, and when A answers, calls party B and connects them; make2WayCallbackFly does the same without needing the Web Callback module. With callbackCallingCard it calls the user back into the calling card application. Both legs are billed to the account named by authname. Use getCallbackStatus to follow a request and cancelCallback to stop it.
make2WayCallback
Section titled “make2WayCallback”Requests a two-way callback: the switch calls cld_first, and when it answers, calls cld_second and connects the two calls. The account must allow at least two simultaneous sessions.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
authname |
string | yes | Authentication name of the account that requests the callback and pays for it |
cld_first |
string | yes | Number to call first |
cld_second |
string | yes | Number to connect the first party to |
cli_first |
string | no | CLI to present on the first leg |
cli_second |
string | no | CLI to present on the second leg |
credit_time |
int | no | End the call after this number of seconds |
next_call |
dateTime | no | When to place the callback, in UTC. Default: at once |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the request is queued |
i_callback_request |
int | ID of the callback request |
Example
Section titled “Example”Connect a customer’s mobile to a support line, for at most one hour:
res = call("make2WayCallback", { "authname": "333333", "cld_first": "447700900123", "cli_first": "442071234567", "cld_second": "442079460000", "credit_time": 3600,})print(res["i_callback_request"]){"result": "OK", "i_callback_request": 52018}make2WayCallbackFly
Section titled “make2WayCallbackFly”Requests a two-way callback exactly like make2WayCallback, but works when the Web Callback module is not installed on the switch. Use it where make2WayCallback fails because the module is missing.
Everything else is the same: the parameters, the checks of the account (it must belong to you, its customer must not be blocked, and it must allow at least two simultaneous sessions), the return value and the errors. The request goes to the same queue, so the switch places the call in the same way, and you follow or stop it with getCallbackStatus and cancelCallback.
The method supports trusted mode with i_customer, the owner of the account; without it the account is looked up under the root customer.
Parameters
Section titled “Parameters”The same as for make2WayCallback: authname, cld_first and cld_second are required, cli_first, cli_second, credit_time and next_call are optional.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the request is queued |
i_callback_request |
int | ID of the callback request |
Example
Section titled “Example”res = call("make2WayCallbackFly", { "authname": "333333", "cld_first": "447700900123", "cld_second": "442079460000", "credit_time": 3600,}){"result": "OK", "i_callback_request": 52020}callbackCallingCard
Section titled “callbackCallingCard”Calls a user back and runs the calling card application on the answered call, as the account named by authname.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
authname |
string | yes | Authentication name of the account that requests the callback |
cld |
string | yes | Number to call back |
cli |
string | no | CLI to present on the callback leg |
langs |
array | no | Languages to offer at the start of the session, for example ["en", "es"] |
credit_time |
int | no | End the callback leg after this number of seconds |
These parameters work like the options in the dialled number of the calling card application:
| Name | Type | Description |
|---|---|---|
chpassext |
string | Extension of the password change menu |
cliregext |
string | Extension of the CLI registration menu |
hotdialext |
string | Extension of the hot dial menu |
hotdialeditext |
string | Extension of the hot dial edit menu |
topupext |
string | Extension of the top-up menu |
directhotdial |
boolean | Dial the hot dial number directly |
keepcli |
boolean | Present the caller’s own number to the destination |
nodial |
boolean | Menus only, no outside calls |
noredial |
boolean | Hang up after the first call attempt |
playbalance |
boolean | Announce the balance |
playduration |
boolean | Announce the duration |
trycliauth |
boolean | Try the caller’s number as the card number |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the request is queued |
i_callback_request |
int | ID of the callback request |
Example
Section titled “Example”call("callbackCallingCard", { "authname": "333333", "cld": "447700900123", "langs": ["en", "es"], "playbalance": True,}){"result": "OK", "i_callback_request": 52019}cancelCallback
Section titled “cancelCallback”Cancels a callback request. A call that has already started is ended.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_callback_request |
int | yes | ID of the callback request |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the cancel request is accepted |
Example
Section titled “Example”call("cancelCallback", {"i_callback_request": 52018}){"result": "OK"}getCallbackStatus
Section titled “getCallbackStatus”Returns the state of a callback request.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_callback_request |
int | yes | ID of the callback request |
fetch_cdrs |
boolean | no | True also returns the CDRs of the request |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
call_status |
string | State of the request, for example Request received |
call_result |
string | Result of the callback call |
cdrs |
array | CDRs of the request, with times in UTC; only with fetch_cdrs |
Example
Section titled “Example”call("getCallbackStatus", {"i_callback_request": 52018, "fetch_cdrs": True}){ "result": "OK", "call_status": "Request received", "call_result": "", "cdrs": [],}Errors
Section titled “Errors”| faultCode | faultString | Cause |
|---|---|---|
401 |
Wrong authname |
No account with this authname belongs to the authenticated customer, or its customer is blocked |
402 |
Callback is not available |
The account’s maximum number of sessions is below 2; a two-way callback needs two |
403 |
Required parameter missing: <name> |
authname, cld_first or cld_second is missing |
make2WayCallback and make2WayCallbackFly return the same errors.
Related
Section titled “Related”- Callback applications: how the switch places the calls, and the two-way callback options
- Calling card application
- Simple API: request a two-way callback with a plain HTTP
GET