Query Trunk List

Query the PBX trunk list.

Request URL

GET {base_url}/{api_path}/trunk/list?access_token={access_token}

Request parameters

Table 1.
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:

  • id
  • name
  • type
  • host_port
  • def_outbound_cid
  • username
order_by No String Define the display order.

Valid value:

  • asc: Ascending order
  • desc: Descending order

Response parameters

Table 2.
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
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
  • account
  • FXO
  • BRI
  • E1
  • J1
  • T1
  • GSM
  • UMTS
  • LTE
  • CDMA
host_port String Hostname and port.
gsm_signal_level Integer GSM signal level.
  • 1: Poor signal strength
  • 2: Medium signal strength
  • 3: Strong signal strength
def_outbound_cid String Trunk outbound caller ID.
username String Username.
Note: This field is only available when the trunk type is register or account.
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.
5 The GSM trunk is registering.
11 The FXO trunk failure.
12 No PSTN line plugged in FXO interface.
21 The E1/BRI trunk is unavailable due to incorrect protocol layer configuration.
22 The E1/BRI trunk failure caused by malfunction in the interface/module.
23 The E1/BRI trunk is unavailable as no trunk plugged in.
31 GSM module failure.
32 GSM trunk module is powered off.
33 No SIM card inserted in GSM module.
34 GSM trunk has no signal.
35 GSM trunk PIN error.
36 GSM cellular network registration failed.
41 SIP register trunk registration failed.
42 SIP trunk is unreachable.
43 SIP account trunk is unavailable.
44 SIP trunk is disabled.

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: 192.168.5.150:8088

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "total_number": 9,
    "data": [
        {
            "id": 14,
            "status": 23,
            "name": "BRI1-1",
            "type": "BRI",
            "host_port": "Span1-Port1"
        },
        {
            "id": 15,
            "status": 23,
            "name": "BRI1-2",
            "type": "BRI",
            "host_port": "Span1-Port2"
        },
        {
            "id": 16,
            "status": 33,
            "name": "UMTS1-3",
            "type": "UMTS",
            "host_port": "Span1-Port3",
            "gsm_signal_level": 1
        },
        {
            "id": 17,
            "status": 12,
            "name": "FXO1-7",
            "type": "FXO",
            "host_port": "Span1-Port7"
        },
        {
            "id": 18,
            "status": 12,
            "name": "FXO1-8",
            "type": "FXO",
            "host_port": "Span1-Port8"
        },
        {
            "id": 27,
            "status": 1,
            "name": "peer-to-41",
            "type": "peer",
            "host_port": "112.48.19.183:18211",
            "def_outbound_cid": "13200000092"
        },
        {
            "id": 29,
            "status": 1,
            "name": "account-for-34",
            "type": "account",
            "username": "6708"
        },
        {
            "id": 30,
            "status": 1,
            "name": "cloud-trunking",
            "type": "register",
            "host_port": "testcloud.clustertest.yeastar.com:5060",
            "username": "6700"
        }
    ]
}