Manage trunk connections
Это содержимое пока не доступно на вашем языке.
A trunk connection is one destination of a trunk: an IP address or host name of the account’s equipment, with its credentials and limits. The switch tries the connections of a trunk in order, or in turn when the trunk’s policy is round-robin. These methods manage the Connections of a trunk on the account’s Trunks screen.
All methods support trusted mode with i_customer.
Trunk connection structure
Section titled “Trunk connection structure”| Name | Type | Description |
|---|---|---|
i_trunk_connection |
int | ID of the connection |
i_trunk |
int | Trunk the connection belongs to |
name |
string | Name of the connection |
destination |
string | Destination: IP address or host name, optionally with a port |
order_no |
int | Position of the connection in the trunk |
username |
string | Username sent to the destination |
password |
string | Password sent to the destination |
outbound_cld |
string | Outbound CLD: number sent to the destination instead of the incoming CLD. Empty keeps the CLD |
outbound_ip |
string | Outbound IP: the switch’s own IP address the calls leave from. Nil is automatic |
capacity |
int | Capacity: maximum simultaneous calls. Nil is unlimited |
max_cps |
double | Max CPS: maximum new calls per second. Nil is unlimited |
from_domain |
string | From Domain: domain name put in the From header instead of the IP address |
random_call_id |
boolean | Random Call-Id: send random Call-ID values so that the destination does not see the callers’ addresses in them |
The methods also accept these SIP fields of a vendor connection. The panel’s trunk form does not show them.
| Name | Type | Description |
|---|---|---|
blocked |
boolean | Blocked: the connection is not used |
i_proto_transport |
int | Protocol: 1 SIP/UDP, 3 IAX2, 4 SIP/TCP, 5 SIP/TLS |
huntstop_scodes |
string | Huntstop SIP Codes: SIP response codes after which the next connection is not tried |
i_privacy_mode |
int | Send Identity As: 1 Off, 2 P-Asserted-Identity, 3 Remote-Party-ID |
use_asserted_id |
boolean | Use CLI As Identity |
use_priv_id_as_cli |
boolean | Use Identity As CLI |
trusted_privacy_domain |
boolean | Trusted Privacy Domain |
asserted_id_translation |
string | Identity Tr. Rule: translation rule for the identity header |
enable_diversion |
boolean | Enable Diversion: send the Diversion header |
createTrunkConnection
Section titled “createTrunkConnection”Adds a connection to a trunk.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_trunk |
int | yes | ID of the trunk |
name |
string | yes | Name of the connection |
destination |
string | yes | IP address or host name |
order_no |
int | no | Position number, or the string first or last. Default last |
| any other field | as in the structure | no | See the structure |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
i_trunk_connection |
int | ID of the new connection |
Example
Section titled “Example”call("createTrunkConnection", { "i_trunk": 52, "name": "Main", "destination": "192.0.2.50:5060", "username": "pbx-in", "password": "s3cret-Pass", "capacity": 30, "max_cps": None,}){"result": "OK", "i_trunk_connection": 118}updateTrunkConnection
Section titled “updateTrunkConnection”Changes a connection or moves it within the trunk. Send only the fields you change.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_trunk_connection |
int | yes | ID of the connection |
order_no |
int | no | Position number, or the string first, last, up (one place earlier) or down (one place later) |
| any other field | as in the structure | no | See the structure. i_trunk cannot be changed |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
i_trunk_connection |
int | ID of the connection |
Example
Section titled “Example”call("updateTrunkConnection", {"i_trunk_connection": 118, "order_no": "first", "outbound_ip": "198.51.100.5"}){"result": "OK", "i_trunk_connection": 118}deleteTrunkConnection
Section titled “deleteTrunkConnection”Deletes a connection.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_trunk_connection |
int | yes | ID of the connection |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
i_trunk_connection |
int | ID of the deleted connection |
Example
Section titled “Example”call("deleteTrunkConnection", {"i_trunk_connection": 118}){"result": "OK", "i_trunk_connection": 118}getTrunkConnectionInfo
Section titled “getTrunkConnectionInfo”Returns one connection.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_trunk_connection |
int | yes | ID of the connection |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
trunk_connection |
struct | The connection, with the fields of the structure |
Example
Section titled “Example”call("getTrunkConnectionInfo", {"i_trunk_connection": 118}){ "result": "OK", "trunk_connection": { "i_trunk_connection": 118, "i_trunk": 52, "name": "Main", "destination": "192.0.2.50:5060", "order_no": 1, "username": "pbx-in", "outbound_cld": "", "outbound_ip": "198.51.100.5", "capacity": 30, "max_cps": None, "from_domain": "", "random_call_id": False, # … the other fields of the structure },}getTrunkConnectionsList
Section titled “getTrunkConnectionsList”Lists the connections of a trunk in order.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_trunk |
int | yes | ID of the trunk |
name_pattern |
string | no | Only connections whose name matches this case-insensitive SQL LIKE pattern: % matches any characters, _ one character |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
trunk_connections |
array | Connections, each a struct with the fields of the structure |
Example
Section titled “Example”call("getTrunkConnectionsList", {"i_trunk": 52}){ "result": "OK", "trunk_connections": [ {"i_trunk_connection": 118, "i_trunk": 52, "name": "Main", "destination": "192.0.2.50:5060", "order_no": 1}, {"i_trunk_connection": 119, "i_trunk": 52, "name": "Backup", "destination": "192.0.2.51:5060", "order_no": 2}, ],}Related
Section titled “Related”- Trunks and incoming routing: the Trunks screen
- Manage trunks
- Manage incoming routes
- Vendor connections