Manage active calls
Цей контент ще не доступний вашою мовою.
These methods show the calls in progress and end them: one call, all calls of an account, or all calls of a customer and its sub-customers. They do the same as the Active Calls screen of the panel. You see only calls of the authenticated customer and its sub-customers; the root customer sees every call.
listAllCalls, listActiveCalls, disconnectCall and disconnectAccount support trusted mode with i_customer; disconnectCustomer with i_wholesaler.
Call structure
Section titled “Call structure”listAllCalls and listActiveCalls return an array of calls. Each call is a struct with upper-case member names:
| Name | Type | Description |
|---|---|---|
ID |
string | ID of the call on the switch; pass it to disconnectCall |
CALL_ID |
string | SIP Call-ID of the call |
CLI |
string | Caller number |
CLD |
string | Called number |
CC_STATE |
string | State of the call; see the table below |
SETUP_TIME |
string | When the call arrived, in UTC, for example 20260115T10:11:52.000 |
DELAY |
double | Delay of the call in seconds, the Delay column of the Active Calls screen |
DURATION |
double | Duration of the call in seconds; 0 while it is not connected |
I_ACCOUNT |
int | ID of the calling account |
I_CUSTOMER |
int | ID of the customer of the account |
I_CONNECTION |
int | ID of the vendor connection the call is routed to |
I_ENVIRONMENT |
int | ID of the environment of the call |
CALLER_MEDIA_IP |
string | Media IP address of the caller |
CALLEE_MEDIA_IP |
string | Media IP address of the called side |
DIRECTION |
string | Direction of the call, for example vendor or onnet_in |
CC_STATE |
Meaning |
|---|---|
Idle |
The call has arrived and processing has started |
WaitAuth |
Authentication has started and is not complete |
WaitRoute |
The call is authenticated; the switch waits for routing |
ARComplete |
Authentication and routing are done; the switch is setting up the call to the vendor |
Connected |
Both legs are connected; the conversation is in progress |
Disconnecting |
The call is being disconnected |
Dead |
The call is disconnected; the switch waits for late SIP messages |
listAllCalls
Section titled “listAllCalls”Returns the calls in every state.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
recursive |
boolean | no | True includes the calls of sub-customers. Default: True |
i_account |
int | no | Only calls of this account |
i_vendor |
int | no | Only calls routed to a connection of this vendor |
i_connection |
int | no | Only calls routed to this connection. Takes precedence over i_vendor |
order |
string | no | Sort order: oldest_first (default), oldest_last, longest_first, longest_last |
Returns
Section titled “Returns”An array of calls, each with the fields of the call structure. Unlike most methods, the response is the array itself, not a struct with result.
Example
Section titled “Example”call("listAllCalls", {"i_account": 3092, "order": "longest_first"})[ { "ID": "944", "CALL_ID": "c80634fb-6f7ad6fd@192.0.2.22", "CLI": "10545", "CLD": "442071234567", "CC_STATE": "Connected", "SETUP_TIME": "20260115T10:12:52.000", "DELAY": 2.2334, "DURATION": 22.7044, "I_ACCOUNT": 3092, "I_CUSTOMER": 3, "I_CONNECTION": 14, "I_ENVIRONMENT": 1, "CALLER_MEDIA_IP": "192.0.2.2", "CALLEE_MEDIA_IP": "198.51.100.49", "DIRECTION": "vendor", },]listActiveCalls
Section titled “listActiveCalls”Returns only the calls in the states WaitRoute, ARComplete and Connected. It takes the same parameters as listAllCalls and returns the same array. The Active Calls screen of the panel uses this method.
Parameters
Section titled “Parameters”The parameters of listAllCalls.
Returns
Section titled “Returns”An array of calls with the fields of the call structure.
Example
Section titled “Example”calls = call("listActiveCalls", {"recursive": False})connected = [c for c in calls if c["CC_STATE"] == "Connected"][ # … one struct per call, as for listAllCalls]disconnectCall
Section titled “disconnectCall”Ends one call.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
ID |
string | yes | ID of the call from listAllCalls or listActiveCalls |
audit_info |
struct | no | Who ends the call, for the audit log; see the audit info structure |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the disconnect request was sent; Call not found or not accessible when the call has already ended or is not yours |
Example
Section titled “Example”call("disconnectCall", {"ID": "944"}){"result": "OK"}disconnectAccount
Section titled “disconnectAccount”Ends all calls of an account. A customer can do this for any account in its hierarchy, including accounts of its sub-customers. To stop the account from calling again, also block it.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_account |
int | yes | ID of the account |
audit_info |
struct | no | Who ends the calls, for the audit log; see the audit info structure |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the disconnect request was sent |
count |
int | Number of calls disconnected |
Example
Section titled “Example”call("disconnectAccount", {"i_account": 3092}){"result": "OK", "count": 2}disconnectCustomer
Section titled “disconnectCustomer”Ends all calls of the accounts of a customer and of all its sub-customers. A customer can do this for any sub-customer in its hierarchy.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_customer |
int | yes | ID of the customer |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when all calls were disconnected |
count |
int | Number of calls disconnected |
Example
Section titled “Example”call("disconnectCustomer", {"i_customer": 27}){"result": "OK", "count": 15}getAccountCallStats
Section titled “getAccountCallStats”Returns the number of calls per account. It is much lighter than listAllCalls or listActiveCalls; use it when you need the counts only. It covers the accounts of the root customer only.
Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
data |
struct | One member per account with calls, named by its i_account. The value is an array [total calls, connected calls] |
Example
Section titled “Example”call("getAccountCallStats", {}){ "result": "OK", "data": { "3092": [3, 2], "3105": [1, 0], },}Related
Section titled “Related”- Block and unblock accounts
- Block and unblock customers
- Read and write audit logs:
CALL_DISCrecords of disconnected calls - Get CDRs of an account: calls after they end