Create Trunk
Description
You can create several type of trunks: SIP, PSTN.
Request
HTTP Method: POST
URI Path: /v3/trunks
Body Parameters:
| Name | Type | Nullable | Is Required? | Description | 
|---|---|---|---|---|
| type | 
 | No | Yes | Trunks | 
| attributes | 
 | No | Yes | Trunk configuration complex object. | 
Data Attributes:
| Name | Type | Nullable | Is Required? | Description | 
|---|---|---|---|---|
| priority | 
 | No | Yes | The priority of this target host.  | 
| weight | 
 | No | Yes | A trunk selection mechanism.  | 
| capacity_limit | 
 | No | No | Maximum number of simultaneous calls for the trunk. | 
| ringing_timeout | 
 | No | Yes | After which it will be end transaction with internal disconnect code Ringing timeout if the call was not connected. | 
| name | 
 | No | Yes | Friendly name of the trunk. | 
| cli_format | 
 | No | Yes | RAW - Do not alter CLI (default).  | 
| cli_prefix | 
 | No | Yes | You may prefix the CLI with an optional  | 
| description | 
 | No | Optional | Optional description of the trunk. | 
| configuration | One of sip_configurations,  | N/A | Yes | Trunk configuration complex object. | 
Attributes Configuration:
| Name | Type | Nullable | Is Required? | Description | 
|---|---|---|---|---|
| type | 
 | No | Yes | SIP configuration complex object. | 
| attributes | No | Yes | SIP configuration attributes object. | 
| Name | Type | Nullable | Is Required? | Description | 
|---|---|---|---|---|
| type | 
 | No | Yes | PSTN configuration complex object. | 
| attributes | No | Yes | PSTN configuration attributes object. | 
Configuration Attributes:
| Name | Type | Nullable | Is Required? | Description | 
|---|---|---|---|---|
| username | 
 | No | Mandatory | User part of R-URI in INVITE request.  | 
| host | 
 | No | Mandatory | Host part of R-URI in INVITE request. | 
| auth_user | 
 | No | Optional | Optional authorization user for the SIP server. | 
| auth_password | 
 | No | Optional | Optional authorization password for the SIP server. | 
| auth_from_user | 
 | No | Optional | Specify user in a from field instead of CallerID (overrides CallerID).  | 
| auth_from_domain | 
 | No | Optional | Sets default from domain in SIP messages. Some equipment may require specific From Domain. | 
| sst_refresh_method_id | 
 | No | Optional | SIP method which will be used for session update.  | 
| sip_timer_b | 
 | No | Optional | INVITE transaction timeout (Default 8000ms).  | 
| dns_srv_failover_timer | 
 | No | Optional | Invite transaction timeout for each of gateways with DNS SRV rerouting (Default 2000ms). | 
| rtp_ping | 
 | No | Optional | Use RTP PING when connecting a call.  | 
| rtp_timeout | 
 | No | Optional | Disconnect the call if the RTP packets do not arrive within the specified time. | 
| sst_min_timer | 
 | No | Optional | Minimal SIP Session timer value (Default 600 seconds).  | 
| sst_max_timer | 
 | No | Optional | Maximal SIP Session timer value (Default 900 seconds)..  | 
| sst_session_expires | 
 | No | Optional | Session-Expires header value. Optional, should be in range with sst_min_timer and sst_max_timer..  | 
| port | 
 | No | Optional | Port part of R-URI in INVITE request (is not mandatory).  | 
| rx_dtmf_format_id | 
 | No | Optional | The method id for receiving DTMF signals from customers equipment.  | 
| tx_dtmf_format_id | 
 | No | Optional | The method of sending DTMF signals to customers equipment.  | 
| force_symmetric_rtp | 
 | No | Optional | Forced to work in Symmetric RTP / COMEDIA mode. | 
| symmetric_rtp_ignore_rtcp | 
 | No | Optional | Avoid switching RTP session based on RTCP packet while working in Symmetric RTP / COMEDIA.  | 
| sst_enabled | 
 | No | Optional | Enable SIP Session timers customization.  | 
| sst_accept_501 | 
 | No | Optional | Do not drop the call after receiving SIP 501 response for non-critical messages. | 
| auth_enabled | 
 | No | Optional | Enable authorization for the SIP server. | 
| resolve_ruri | 
 | No | Optional | Replace host part of the R-URI by resolved IP address. | 
| rerouting_disconnect_code_ids | 
 | No | Optional | |
| codec_ids | 
 | No | Optional | |
| transport_protocol_id | 
 | No | Mandatory | The transport layer that will be responsible for the actual transmission of SIP requests and responses (1 - UDP, 2 - TCP, 3 - TLS). | 
| max_transfers | 
 | No | Optional | Max count of the REFER requests. | 
| max_30x_redirects | 
 | No | Optional | Max count of 301/302 redirects. | 
| Name | Type | Nullable | Is Required? | Description | 
|---|---|---|---|---|
| dst | 
 | No | Mandatory | Phone number’s. | 
Examples
http
POST /v3/trunks HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API token]
{
  "data": {
    "type": "trunks",
    "attributes": {
      "priority": "1",
      "weight": "2",
      "capacity_limit": 10,
      "ringing_timeout": 30,
      "name": "Office",
      "cli_format": "e164",
      "cli_prefix": "+",
      "description": "custom description",
      "configuration": {
        "type": "sip_configurations",
        "attributes": {
          "username": "username",
          "host": "example.com",
          "codec_ids": [
            9,
            7
          ],
          "rx_dtmf_format_id": 1,
          "tx_dtmf_format_id": 1,
          "resolve_ruri": "true",
          "auth_enabled": true,
          "auth_user": "username",
          "auth_password": "password",
          "auth_from_user": "Office",
          "auth_from_domain": "example.com",
          "sst_enabled": "false",
          "sst_min_timer": 600,
          "sst_max_timer": 900,
          "sst_refresh_method_id": 1,
          "sst_accept_501": "true",
          "sip_timer_b": 8000,
          "dns_srv_failover_timer": 2000,
          "rtp_ping": "false",
          "rtp_timeout": 30,
          "force_symmetric_rtp": "false",
          "symmetric_rtp_ignore_rtcp": "false",
          "rerouting_disconnect_code_ids": [
            58,
            59
          ],
          "port": 5060,
          "transport_protocol_id": 2,
          "max_transfers": 0,
          "max_30x_redirects": 0
        }
      }
    }
  }
}
curl
curl -i -X POST https://api.didww.com/v3/trunks -H "Accept: application/vnd.api+json" -H "Api-Key: [API token]" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"attributes": {"capacity_limit": 10, "cli_format": "e164", "cli_prefix": "+", "configuration": {"attributes": {"auth_enabled": true, "auth_from_domain": "example.com", "auth_from_user": "Office", "auth_password": "password", "auth_user": "username", "codec_ids": [9, 7], "dns_srv_failover_timer": 2000, "force_symmetric_rtp": "false", "host": "example.com", "max_30x_redirects": 0, "max_transfers": 0, "port": 5060, "rerouting_disconnect_code_ids": [58, 59], "resolve_ruri": "true", "rtp_ping": "false", "rtp_timeout": 30, "rx_dtmf_format_id": 1, "sip_timer_b": 8000, "sst_accept_501": "true", "sst_enabled": "false", "sst_max_timer": 900, "sst_min_timer": 600, "sst_refresh_method_id": 1, "symmetric_rtp_ignore_rtcp": "false", "transport_protocol_id": 2, "tx_dtmf_format_id": 1, "username": "username"}, "type": "sip_configurations"}, "description": "custom description", "name": "Office", "priority": "1", "ringing_timeout": 30, "weight": "2"}, "type": "trunks"}}'
response
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
  "data": {
    "id": "f36d1d17-bd16-42b9-af42-0cfe166bf3ec",
    "type": "trunks",
    "attributes": {
      "priority": 1,
      "capacity_limit": 10,
      "weight": 2,
      "name": "Office",
      "cli_format": "e164",
      "cli_prefix": "+",
      "description": "custom description",
      "ringing_timeout": 30,
      "created_at": "2017-06-25T08:21:41.795Z",
      "configuration": {
        "type": "sip_configurations",
        "attributes": {
          "username": "username",
          "host": "example.com",
          "port": 5060,
          "codec_ids": [
            9,
            7
          ],
          "rx_dtmf_format_id": 1,
          "tx_dtmf_format_id": 1,
          "resolve_ruri": true,
          "auth_enabled": true,
          "auth_user": "username",
          "auth_password": "password",
          "auth_from_user": "Office",
          "auth_from_domain": "example.com",
          "sst_enabled": false,
          "sst_min_timer": 600,
          "sst_max_timer": 900,
          "sst_accept_501": true,
          "sip_timer_b": 8000,
          "dns_srv_failover_timer": 2000,
          "rtp_ping": false,
          "rtp_timeout": 30,
          "force_symmetric_rtp": false,
          "symmetric_rtp_ignore_rtcp": false,
          "rerouting_disconnect_code_ids": [
            58,
            59
          ],
          "sst_session_expires": null,
          "sst_refresh_method_id": 1,
          "transport_protocol_id": 2,
          "max_transfers": 0,
          "max_30x_redirects": 0
        }
      }
    },
    "relationships": {
      "trunk_group": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/relationships/trunk_group",
          "related": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/trunk_group"
        }
      },
      "pop": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/relationships/pop",
          "related": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/pop"
        }
      }
    }
  }
}
http
POST /v3/trunks HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API token]
{
  "data": {
    "type": "trunks",
    "attributes": {
      "name": "Office Mobile",
      "capacity_limit": 5,
      "configuration": {
        "type": "pstn_configurations",
        "attributes": {
          "dst": "1xxxxxxxxx"
        }
      }
    }
  }
}
curl
curl -i -X POST https://api.didww.com/v3/trunks -H "Accept: application/vnd.api+json" -H "Api-Key: [API token]" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"attributes": {"capacity_limit": 5, "configuration": {"attributes": {"dst": "1xxxxxxxxx"}, "type": "pstn_configurations"}, "name": "Office Mobile"}, "type": "trunks"}}'
response
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
  "data": {
    "id": "28b360b9-0d35-4c94-bbfd-1c33a7680b34",
    "type": "trunks",
    "attributes": {
      "priority": 1,
      "capacity_limit": 5,
      "weight": 65535,
      "name": "Office Mobile",
      "cli_format": "e164",
      "cli_prefix": null,
      "description": null,
      "ringing_timeout": null,
      "created_at": "2017-06-25T08:21:41.795Z",
      "configuration": {
        "type": "pstn_configurations",
        "attributes": {
          "dst": "1xxxxxxxxx"
        }
      }
    },
    "relationships": {
      "trunk_group": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/relationships/trunk_group",
          "related": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/trunk_group"
        }
      },
      "pop": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/relationships/pop",
          "related": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/pop"
        }
      }
    }
  }
}
http
POST /v3/trunks HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API token]
{
  "data": {
    "type": "trunks",
    "attributes": {
      "name": "Office SIP",
      "capacity_limit": 18,
      "cli_format": "e164",
      "cli_prefix": "+1",
      "configuration": {
        "type": "sip_configurations",
        "attributes": {
          "username": "username",
          "host": "example.com",
          "codec_ids": [
            9,
            7
          ],
          "rx_dtmf_format_id": 1,
          "tx_dtmf_format_id": 1,
          "resolve_ruri": "true",
          "auth_enabled": true,
          "auth_user": "username",
          "auth_password": "password",
          "auth_from_user": "Office",
          "auth_from_domain": "example.com",
          "sst_enabled": "false",
          "sst_min_timer": 600,
          "sst_max_timer": 900,
          "sst_refresh_method_id": 1,
          "sst_accept_501": "true",
          "sip_timer_b": 8000,
          "dns_srv_failover_timer": 2000,
          "rtp_ping": "false",
          "rtp_timeout": 30,
          "force_symmetric_rtp": "false",
          "symmetric_rtp_ignore_rtcp": "false",
          "rerouting_disconnect_code_ids": [
            58,
            59
          ],
          "port": 5060,
          "transport_protocol_id": 2,
          "max_transfers": 0,
          "max_30x_redirects": 0
        }
      }
    },
    "relationships": {
      "pop": {
        "data": {
          "type": "pops",
          "id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf"
        }
      }
    }
  }
}
curl
curl -i -X POST https://api.didww.com/v3/trunks -H "Accept: application/vnd.api+json" -H "Api-Key: [API token]" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"attributes": {"capacity_limit": 18, "cli_format": "e164", "cli_prefix": "+1", "configuration": {"attributes": {"auth_enabled": true, "auth_from_domain": "example.com", "auth_from_user": "Office", "auth_password": "password", "auth_user": "username", "codec_ids": [9, 7], "dns_srv_failover_timer": 2000, "force_symmetric_rtp": "false", "host": "example.com", "max_30x_redirects": 0, "max_transfers": 0, "port": 5060, "rerouting_disconnect_code_ids": [58, 59], "resolve_ruri": "true", "rtp_ping": "false", "rtp_timeout": 30, "rx_dtmf_format_id": 1, "sip_timer_b": 8000, "sst_accept_501": "true", "sst_enabled": "false", "sst_max_timer": 900, "sst_min_timer": 600, "sst_refresh_method_id": 1, "symmetric_rtp_ignore_rtcp": "false", "transport_protocol_id": 2, "tx_dtmf_format_id": 1, "username": "username"}, "type": "sip_configurations"}, "name": "Office SIP"}, "relationships": {"pop": {"data": {"id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf", "type": "pops"}}}, "type": "trunks"}}'
response
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
  "data": {
    "id": "7adfab4e-83bc-45e2-84e6-60342a505713",
    "type": "trunks",
    "attributes": {
      "priority": 1,
      "capacity_limit": 18,
      "weight": 65535,
      "name": "Office SIP",
      "cli_format": "e164",
      "cli_prefix": "+1",
      "description": null,
      "ringing_timeout": null,
      "configuration": {
        "type": "sip_configurations",
        "attributes": {
          "username": "username",
          "host": "example.com",
          "port": 5060,
          "codec_ids": [
            9,
            7
          ],
          "rx_dtmf_format_id": 1,
          "tx_dtmf_format_id": 1,
          "resolve_ruri": true,
          "auth_enabled": true,
          "auth_user": "username",
          "auth_password": "password",
          "auth_from_user": "Office",
          "auth_from_domain": "example.com",
          "sst_enabled": false,
          "sst_min_timer": 600,
          "sst_max_timer": 900,
          "sst_accept_501": true,
          "sip_timer_b": 8000,
          "dns_srv_failover_timer": 2000,
          "rtp_ping": false,
          "rtp_timeout": 30,
          "force_symmetric_rtp": false,
          "symmetric_rtp_ignore_rtcp": false,
          "rerouting_disconnect_code_ids": [
            58,
            59
          ],
          "sst_session_expires": null,
          "sst_refresh_method_id": 1,
          "transport_protocol_id": 2,
          "max_transfers": 0,
          "max_30x_redirects": 0
        }
      }
    },
    "relationships": {
      "trunk_group": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/relationships/trunk_group",
          "related": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/trunk_group"
        }
      },
      "pop": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/relationships/pop",
          "related": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/pop"
        },
        "data": {
          "type": "pops",
          "id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf"
        }
      }
    }
  },
  "included": [
    {
      "id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf",
      "type": "pops",
      "links": {
        "self": "https://api.didww.com/v3/pops/240416e4-aeb2-4ca5-9df2-f37f01e930cf"
      },
      "attributes": {
        "name": "USA, NY"
      }
    }
  ]
}
Other Responses
| Code | Success | Description | 
|---|---|---|
| 422 | No | |
| 401 | No |