Перейти к содержимому

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.

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

Returns the calls in every state.

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

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.

request
call("listAllCalls", {"i_account": 3092, "order": "longest_first"})
response
[
{
"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",
},
]

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.

The parameters of listAllCalls.

An array of calls with the fields of the call structure.

request
calls = call("listActiveCalls", {"recursive": False})
connected = [c for c in calls if c["CC_STATE"] == "Connected"]
response
[
# … one struct per call, as for listAllCalls
]

Ends one call.

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
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
request
call("disconnectCall", {"ID": "944"})
response
{"result": "OK"}

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.

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
Name Type Description
result string OK when the disconnect request was sent
count int Number of calls disconnected
request
call("disconnectAccount", {"i_account": 3092})
response
{"result": "OK", "count": 2}

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.

Name Type Required Description
i_customer int yes ID of the customer
Name Type Description
result string OK when all calls were disconnected
count int Number of calls disconnected
request
call("disconnectCustomer", {"i_customer": 27})
response
{"result": "OK", "count": 15}

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.

None.

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]
request
call("getAccountCallStats", {})
response
{
"result": "OK",
"data": {
"3092": [3, 2],
"3105": [1, 0],
},
}