Query Trunk List
Query the PBX trunk list.
Request URL
GET {base_url}/{api_path}/trunk/list?access_token={access_token}
Request parameters
Parameter | Required | Type | Description |
---|---|---|---|
page | No | Integer | Define which page is displayed. |
page_size | No | Integer | Define how many records per page. |
sort_by | No | String | Define the sorting field. Valid value:
|
order_by | No | String | Define the display order. Valid value:
|
Response parameters
Parameter | Type | Description |
---|---|---|
errcode | Integer | Returned error code.
Note: You can check the error code and
error message in Error Code and Error Message.
|
errmsg | String | Returned message.
|
total_number | Integer | The total number of trunk. |
data | Array <Trunk_Info> | The information of a trunk. |
- Trunk_Info
-
Table 3. Parameter Type Description id Integer Trunk ID. status Integer Trunk status. name String Trunk name. type String Trunk type. register
peer_did
peer_port
peer_private
account
host_port String Hostname and port. def_outbound_cid String Trunk outbound caller ID. username String Username. Note: This field is only available when the trunk type isregister
oraccount
.
- Trunk status
-
Table 4. Status Description 0 Unknown status. 1 The trunk is idle. 2 The trunk is busy. 3 The SIP trunk is idle and unmonitored. 4 The SIP trunk is registering. 41 SIP register trunk registration failed. 42 SIP trunk is unreachable. 43 SIP account trunk is unavailable. 44 SIP trunk is disabled. 45 SIP register trunk authentication failed.
Examples
Request example
GET /openapi/v1.0/trunk/list?page=1&page_size=20&sort_by=id&order_by=asc&access_token=ibKIdUFs0r7uARhRzrMg8TTOfiZPtaav HTTP/1.1
Host: yeastardocs.example.yeastarcloud.com
Response example
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS",
"total_number": 3,
"data": [
{
"id": 8,
"status": 41,
"name": "Local_Calls",
"type": "register",
"host_port": "abc.provider.com:5060",
"username": "6701",
"def_outbound_cid": "5503300"
},
{
"id": 9,
"status": 4,
"name": "International_Calls",
"type": "peer_did",
"host_port": "test.provider.com:5060",
"def_outbound_cid": "5502283"
},
{
"id": 12,
"status": 43,
"name": "ToPAE",
"type": "account",
"username": "6700"
}
]
}