Add a SIP Trunk

Add and configure a SIP trunk.

Request URL

{base_url}/{api_path}/trunk/add_siptrunk?token={token}

Request parameters

Send different request parameters according to different types of SIP trunk.
Add a register trunk
Parameter Required Type Description
trunkname Yes String Trunk name.
trunktype Yes String Trunk type.

Valid value: register

host Yes String The domain or IP address of the ITSP.
port Yes String The port of the SIP trunk.

Default value: 5060

domain Yes String The domain or IP address of the ITSP.
username Yes String The SIP account that is provided by the ITSP.
authname Yes String The SIP account that is provided by the ITSP.
fromuser No String If fromuser is set, all outgoing calls from this SIP trunk will use the fromuser value as From Header of the SIP INVITE packets.
Note: Leave the parameter blank if ITSP does not support this feature.
password Yes String The password of the SIP account.
extensionsdod No String

The DOD number that is bound with an extension.

Valid values:

  • A DOD number

    Format:

    "extensionsdod":"{dod_number}-{dod_name}-{extension_number}"

    Example:

    "extensionsdod":"5503301-yeastar-1000"
  • Multiple DOD numbers

    Format:

    "extensionsdod":"{dod_number}-{dod_name}-{extension_number}"

    Separate multiple DOD numbers with ,.

    Example:

    "extensionsdod":"5503301-yeastar-1000,5503302-yeastar-1001"
extensionsgroupdod No String The DOD number that is bound with an extension group.
  • A DOD number

    Format:

    "extensionsgroupdod":"{dod_number}-{dod_name}-{extension_group_name}
    Example:
    "extensionsgroupdod":"5503301-yeastar-sales"
  • Multiple DOD numbers:

    Format:

    "extensionsgroupdod":"{dod_number}-{dod_name}-{extension_group_name}

    Separate multiple DOD numbers with ,.

    Example:

    "extensionsgroupdod":"5503301-yeastar-sales,5503302-yeastar-support"
Add a peer trunk
Parameter Required Type Description
trunkname Yes String Trunk name.
trunktype Yes String Trunk type.

Valid value: peer

host Yes String The domain or IP address of the ITSP.
port Yes String The port of the SIP trunk.
domain Yes String The domain or IP address of the ITSP.
extensionsdod No String

The DOD number that is bound with an extension.

Valid values:

  • A DOD number

    Format:

    "extensionsdod":"{dod_number}-{dod_name}-{extension_number}"

    Example:

    "extensionsdod":"5503301-yeastar-1000"
  • Multiple DOD numbers

    Format:

    "extensionsdod":"{dod_number}-{dod_name}-{extension_number}"

    Separate multiple DOD numbers with ,.

    Example:

    "extensionsdod":"5503301-yeastar-1000,5503302-yeastar-1001"
extensionsgroupdod No String The DOD number that is bound with an extension group.
  • A DOD number

    Format:

    "extensionsgroupdod":"{dod_number}-{dod_name}-{extension_group_name}
    Example:
    "extensionsgroupdod":"5503301-yeastar-sales"
  • Multiple DOD numbers:

    Format:

    "extensionsgroupdod":"{dod_number}-{dod_name}-{extension_group_name}

    Separate multiple DOD numbers with ,.

    Example:

    "extensionsgroupdod":"5503301-yeastar-sales,5503302-yeastar-support"
Add an account trunk
Parameter Required Type Description
trunkname Yes String Trunk name.
trunktype Yes String Trunk type.

Valid value: account.

username Yes String The user name of the Account Trunk.
authname Yes String The authentication name of the Account Trunk.
password Yes String The password of the Account Trunk.
extensionsdod No String

The DOD number that is bound with an extension.

Valid values:

  • A DOD number

    Format:

    "extensionsdod":"{dod_number}-{dod_name}-{extension_number}"

    Example:

    "extensionsdod":"5503301-yeastar-1000"
  • Multiple DOD numbers

    Format:

    "extensionsdod":"{dod_number}-{dod_name}-{extension_number}"

    Separate multiple DOD numbers with ,.

    Example:

    "extensionsdod":"5503301-yeastar-1000,5503302-yeastar-1001"
extensionsgroupdod No String The DOD number that is bound with an extension group.
  • A DOD number

    Format:

    "extensionsgroupdod":"{dod_number}-{dod_name}-{extension_group_name}
    Example:
    "extensionsgroupdod":"5503301-yeastar-sales"
  • Multiple DOD numbers:

    Format:

    "extensionsgroupdod":"{dod_number}-{dod_name}-{extension_group_name}

    Separate multiple DOD numbers with ,.

    Example:

    "extensionsgroupdod":"5503301-yeastar-sales,5503302-yeastar-support"

Response parameters

Parameter Type Description
id Integer The unique ID of a trunk.
status String Request result.
  • Success
  • Failed

Examples

Request example

Add a register trunk, and the trunk name is "Trunk1".

POST /api/v2.0.0/trunk/add_siptrunk?token=277ac400357b509b4a587ff2157f7ad5
Content-Type:application/json; charset=utf-8
Host: 192.168.5.150

{
    "trunkname": "Trunk1",
    "trunktype": "register",
    "host": "192.168.12.161",
    "port": "5060",
    "domain": "192.168.12.161",
    "username": "1001",
    "authname": "1001",
    "password": "Pajsjx9183",
}

Response example

After the register trunk is added successfully, the system will automatically assign an id to the trunk.

HTTP/1.1 200 OK
Server: Boa/0.94.14rc21
Accept-Ranges: bytes
Connection: close
Content-Type: application/json
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE

{
	"id": "10",
	"status": "Success"
}