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 |
No |
Ring time in seconds. Supported values are integers from 1 to 32. If |
name |
|
No |
Yes |
Friendly name of the trunk. |
cli_format |
|
No |
No |
RAW - Do not alter CLI (default). |
cli_prefix |
|
No |
No |
You may prefix the CLI with an optional |
description |
|
No |
No |
Optional description of the trunk. |
configuration |
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 |
Yes |
User part of R-URI in INVITE request. |
host |
|
No |
Yes |
Host part of R-URI in INVITE request. |
media_encryption_mode |
|
No |
No |
Media encryption mode. |
stir_shaken_mode |
|
No |
No |
Stir/Shaken mode. |
auth_user |
|
No |
No |
Optional authorization user for the SIP server. |
auth_password |
|
No |
No |
Optional authorization password for the SIP server. |
auth_from_user |
|
No |
No |
Specify user in a from field instead of CallerID (overrides CallerID). |
auth_from_domain |
|
No |
No |
Sets default from domain in SIP messages. Some equipment may require specific From Domain. |
sst_refresh_method_id |
|
No |
No |
SIP method which will be used for session update. |
sip_timer_b |
|
No |
No |
INVITE transaction timeout (Default 8000ms). |
dns_srv_failover_timer |
|
No |
No |
Invite transaction timeout for each of gateways with DNS SRV rerouting (Default 2000ms). |
rtp_ping |
|
No |
No |
Use RTP PING when connecting a call. |
rtp_timeout |
|
No |
No |
Disconnect the call if the RTP packets do not arrive within the specified time. |
allowed_rtp_ips |
Array of |
No |
No |
The allowed RTP IPs. Array from 0 to 10 items: IPv4 or IPv6, single or subnet. |
sst_min_timer |
|
No |
No |
Minimal SIP Session timer value (Default 600 seconds). |
sst_max_timer |
|
No |
No |
Maximal SIP Session timer value (Default 900 seconds). |
sst_session_expires |
|
No |
No |
Session-Expires header value. Optional, should be in range with sst_min_timer and sst_max_timer. |
port |
|
No |
No |
Port part of R-URI in INVITE request (is not mandatory). |
rx_dtmf_format_id |
|
No |
No |
The method id for receiving DTMF signals from customers equipment. |
tx_dtmf_format_id |
|
No |
No |
The method of sending DTMF signals to the customer’s equipment. |
force_symmetric_rtp |
|
No |
No |
Forced to work in Symmetric RTP / COMEDIA mode. |
symmetric_rtp_ignore_rtcp |
|
No |
No |
Avoid switching RTP session based on RTCP packet while working in Symmetric RTP / COMEDIA. |
sst_enabled |
|
No |
No |
Enable SIP Session timers customization. |
sst_accept_501 |
|
No |
No |
Do not drop the call after receiving SIP 501 response for non-critical messages. |
auth_enabled |
|
No |
No |
Enable authorization for the SIP server. |
resolve_ruri |
|
No |
No |
Replace host part of the R-URI by resolved IP address. |
rerouting_disconnect_code_ids |
|
No |
No |
|
codec_ids |
|
No |
No |
|
transport_protocol_id |
|
No |
No |
The transport layer that will be responsible for the actual transmission of SIP requests and responses: |
max_transfers |
|
No |
No |
Max count of the REFER requests. |
max_30x_redirects |
|
No |
No |
Max count of 301/302 redirects. |
Name |
Type |
Nullable |
Is Required? |
Description |
|---|---|---|---|---|
dst |
|
No |
Yes |
Phone number’s. |
Examples#
http
1POST /v3/trunks HTTP/1.1
2Host: api.didww.com
3Content-Type: application/vnd.api+json
4Accept: application/vnd.api+json
5Api-Key: [API token]
6
7{
8 "data": {
9 "type": "trunks",
10 "attributes": {
11 "priority": "1",
12 "weight": "2",
13 "capacity_limit": 10,
14 "ringing_timeout": 30,
15 "name": "Office",
16 "cli_format": "e164",
17 "cli_prefix": "+",
18 "description": "custom description",
19 "configuration": {
20 "type": "sip_configurations",
21 "attributes": {
22 "username": "username",
23 "host": "example.com",
24 "codec_ids": [
25 9,
26 7
27 ],
28 "rx_dtmf_format_id": 1,
29 "tx_dtmf_format_id": 1,
30 "resolve_ruri": "true",
31 "auth_enabled": true,
32 "auth_user": "username",
33 "auth_password": "password",
34 "auth_from_user": "Office",
35 "auth_from_domain": "example.com",
36 "sst_enabled": "false",
37 "sst_min_timer": 600,
38 "sst_max_timer": 900,
39 "sst_refresh_method_id": 1,
40 "sst_accept_501": "true",
41 "sip_timer_b": 8000,
42 "dns_srv_failover_timer": 2000,
43 "rtp_ping": "false",
44 "rtp_timeout": 30,
45 "force_symmetric_rtp": "false",
46 "symmetric_rtp_ignore_rtcp": "false",
47 "rerouting_disconnect_code_ids": [
48 58,
49 59
50 ],
51 "port": 5060,
52 "transport_protocol_id": 2,
53 "max_transfers": 0,
54 "max_30x_redirects": 0
55 }
56 }
57 }
58 }
59}
curl
1curl -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
1HTTP/1.1 201 Created
2Content-Type: application/vnd.api+json
3
4{
5 "data": {
6 "id": "f36d1d17-bd16-42b9-af42-0cfe166bf3ec",
7 "type": "trunks",
8 "attributes": {
9 "priority": 1,
10 "capacity_limit": 10,
11 "weight": 2,
12 "name": "Office",
13 "cli_format": "e164",
14 "cli_prefix": "+",
15 "description": "custom description",
16 "ringing_timeout": 30,
17 "created_at": "2017-06-25T08:21:41.795Z",
18 "configuration": {
19 "type": "sip_configurations",
20 "attributes": {
21 "username": "username",
22 "host": "example.com",
23 "port": 5060,
24 "codec_ids": [
25 9,
26 7
27 ],
28 "rx_dtmf_format_id": 1,
29 "tx_dtmf_format_id": 1,
30 "resolve_ruri": true,
31 "auth_enabled": true,
32 "auth_user": "username",
33 "auth_password": "password",
34 "auth_from_user": "Office",
35 "auth_from_domain": "example.com",
36 "sst_enabled": false,
37 "sst_min_timer": 600,
38 "sst_max_timer": 900,
39 "sst_accept_501": true,
40 "sip_timer_b": 8000,
41 "dns_srv_failover_timer": 2000,
42 "rtp_ping": false,
43 "rtp_timeout": 30,
44 "force_symmetric_rtp": false,
45 "symmetric_rtp_ignore_rtcp": false,
46 "rerouting_disconnect_code_ids": [
47 58,
48 59
49 ],
50 "sst_session_expires": null,
51 "sst_refresh_method_id": 1,
52 "transport_protocol_id": 2,
53 "max_transfers": 0,
54 "max_30x_redirects": 0
55 }
56 }
57 },
58 "relationships": {
59 "trunk_group": {
60 "links": {
61 "self": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/relationships/trunk_group",
62 "related": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/trunk_group"
63 }
64 },
65 "pop": {
66 "links": {
67 "self": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/relationships/pop",
68 "related": "https://api.didww.com/v3/trunks/f36d1d17-bd16-42b9-af42-0cfe166bf3ec/pop"
69 }
70 }
71 }
72 }
73}
http
1POST /v3/trunks HTTP/1.1
2Host: api.didww.com
3Content-Type: application/vnd.api+json
4Accept: application/vnd.api+json
5Api-Key: [API token]
6
7{
8 "data": {
9 "type": "trunks",
10 "attributes": {
11 "name": "Office Mobile",
12 "capacity_limit": 5,
13 "configuration": {
14 "type": "pstn_configurations",
15 "attributes": {
16 "dst": "1xxxxxxxxx"
17 }
18 }
19 }
20 }
21}
curl
1curl -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
1HTTP/1.1 201 Created
2Content-Type: application/vnd.api+json
3
4{
5 "data": {
6 "id": "28b360b9-0d35-4c94-bbfd-1c33a7680b34",
7 "type": "trunks",
8 "attributes": {
9 "priority": 1,
10 "capacity_limit": 5,
11 "weight": 65535,
12 "name": "Office Mobile",
13 "cli_format": "e164",
14 "cli_prefix": null,
15 "description": null,
16 "ringing_timeout": null,
17 "created_at": "2017-06-25T08:21:41.795Z",
18 "configuration": {
19 "type": "pstn_configurations",
20 "attributes": {
21 "dst": "1xxxxxxxxx"
22 }
23 }
24 },
25 "relationships": {
26 "trunk_group": {
27 "links": {
28 "self": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/relationships/trunk_group",
29 "related": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/trunk_group"
30 }
31 },
32 "pop": {
33 "links": {
34 "self": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/relationships/pop",
35 "related": "https://api.didww.com/v3/trunks/28b360b9-0d35-4c94-bbfd-1c33a7680b34/pop"
36 }
37 }
38 }
39 }
40}
http
1POST /v3/trunks HTTP/1.1
2Host: api.didww.com
3Content-Type: application/vnd.api+json
4Accept: application/vnd.api+json
5Api-Key: [API token]
6
7{
8 "data": {
9 "type": "trunks",
10 "attributes": {
11 "name": "Office SIP",
12 "capacity_limit": 18,
13 "cli_format": "e164",
14 "cli_prefix": "+1",
15 "configuration": {
16 "type": "sip_configurations",
17 "attributes": {
18 "username": "username",
19 "host": "example.com",
20 "codec_ids": [
21 9,
22 7
23 ],
24 "rx_dtmf_format_id": 1,
25 "tx_dtmf_format_id": 1,
26 "resolve_ruri": "true",
27 "auth_enabled": true,
28 "auth_user": "username",
29 "auth_password": "password",
30 "auth_from_user": "Office",
31 "auth_from_domain": "example.com",
32 "sst_enabled": "false",
33 "sst_min_timer": 600,
34 "sst_max_timer": 900,
35 "sst_refresh_method_id": 1,
36 "sst_accept_501": "true",
37 "sip_timer_b": 8000,
38 "dns_srv_failover_timer": 2000,
39 "rtp_ping": "false",
40 "rtp_timeout": 30,
41 "force_symmetric_rtp": "false",
42 "symmetric_rtp_ignore_rtcp": "false",
43 "rerouting_disconnect_code_ids": [
44 58,
45 59
46 ],
47 "port": 5060,
48 "transport_protocol_id": 2,
49 "max_transfers": 0,
50 "max_30x_redirects": 0
51 }
52 }
53 },
54 "relationships": {
55 "pop": {
56 "data": {
57 "type": "pops",
58 "id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf"
59 }
60 }
61 }
62 }
63}
curl
1curl -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
1HTTP/1.1 201 Created
2Content-Type: application/vnd.api+json
3
4{
5 "data": {
6 "id": "7adfab4e-83bc-45e2-84e6-60342a505713",
7 "type": "trunks",
8 "attributes": {
9 "priority": 1,
10 "capacity_limit": 18,
11 "weight": 65535,
12 "name": "Office SIP",
13 "cli_format": "e164",
14 "cli_prefix": "+1",
15 "description": null,
16 "ringing_timeout": null,
17 "configuration": {
18 "type": "sip_configurations",
19 "attributes": {
20 "username": "username",
21 "host": "example.com",
22 "port": 5060,
23 "codec_ids": [
24 9,
25 7
26 ],
27 "rx_dtmf_format_id": 1,
28 "tx_dtmf_format_id": 1,
29 "resolve_ruri": true,
30 "auth_enabled": true,
31 "auth_user": "username",
32 "auth_password": "password",
33 "auth_from_user": "Office",
34 "auth_from_domain": "example.com",
35 "sst_enabled": false,
36 "sst_min_timer": 600,
37 "sst_max_timer": 900,
38 "sst_accept_501": true,
39 "sip_timer_b": 8000,
40 "dns_srv_failover_timer": 2000,
41 "rtp_ping": false,
42 "rtp_timeout": 30,
43 "force_symmetric_rtp": false,
44 "symmetric_rtp_ignore_rtcp": false,
45 "rerouting_disconnect_code_ids": [
46 58,
47 59
48 ],
49 "sst_session_expires": null,
50 "sst_refresh_method_id": 1,
51 "transport_protocol_id": 2,
52 "max_transfers": 0,
53 "max_30x_redirects": 0
54 }
55 }
56 },
57 "relationships": {
58 "trunk_group": {
59 "links": {
60 "self": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/relationships/trunk_group",
61 "related": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/trunk_group"
62 }
63 },
64 "pop": {
65 "links": {
66 "self": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/relationships/pop",
67 "related": "https://api.didww.com/v3/trunks/389deacb-5be5-46d7-8cbd-aba11f66d6c2/pop"
68 },
69 "data": {
70 "type": "pops",
71 "id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf"
72 }
73 }
74 }
75 },
76 "included": [
77 {
78 "id": "240416e4-aeb2-4ca5-9df2-f37f01e930cf",
79 "type": "pops",
80 "links": {
81 "self": "https://api.didww.com/v3/pops/240416e4-aeb2-4ca5-9df2-f37f01e930cf"
82 },
83 "attributes": {
84 "name": "USA, NY"
85 }
86 }
87 ]
88}
Other Responses#
Code |
Success |
Description |
|---|---|---|
422 |
No |
|
401 |
No |