Update Trunk

Description

Updates a Trunk.

Request

HTTP Method: PATCH

URI Path: /v3/trunks/

URI Query Parameters:

Name

Type

Is Required?

Description

id

string

Yes

Unique ID identifier of Trunk.

Data Attributes:

Name

Type

Nullable

Is Required?

Description

priority

integer

No

Yes

The priority of this target host.
DIDWW will attempt to contact the target trunk with the lowest-numbered priority;
target trunk with the same priority will be tried in an order defined by the weight field.
The range is 0-65535. See RFC 2782 for more details.

weight

integer

No

Yes

A trunk selection mechanism.
The weight field specifies a relative weight for entries with the same priority.
Larger weights will be given a proportionately higher probability of being selected.
The range of this number is 0-65535.
In the presence of records containing weights greater than 0, records with weight 0 will have a very small chance of being selected.
See RFC 2782 for more details.

capacity_limit

integer

No

Yes

Maximum number of simultaneous calls for the trunk.

ringing_timeout

integer

No

Yes

After which it will be end transaction with internal disconnect code Ringing timeout if the call was not connected.

name

string

No

Yes

Friendly name of the trunk.

cli_format

string

No

Yes

RAW - Do not alter CLI (default).
E164 - Attempt to convert CLI to E.164 format.
Local - Attempt to convert CLI to Localized format.
CLI format conversion may not work correctly for phone calls originating from outside the country of that specific DID.

cli_prefix

string

No

Yes

You may prefix the CLI with an optional + sign followed by up to 6 characters, including digits and #.

description

string

No

Optional

Optional description of the trunk.

configuration

One of sip_configurations ,
pstn_configurations ,

N/A

Yes

Trunk configuration complex object.

Attributes Configuration:

Name

Type

Nullable

Is Required?

Description

type

sip_configurations

No

Yes

SIP configuration complex object.

attributes

sip_configuration_attributes

No

Yes

SIP configuration attributes object.

Configuration Attributes:

Name

Type

Nullable

Is Required?

Description

username

string

No

Mandatory

User part of R-URI in INVITE request.
You also may use “{DID}” pattern which will be replaced by called DID number in E164 format.
For example, you can set Username to “+{DID}”; if you wish to have it in +E164 format

host

string

No

Mandatory

Host part of R-URI in INVITE request.

auth_user

string

No

Optional

Optional authorization user for the SIP server.

auth_password

string

No

Optional

Optional authorization password for the SIP server.

auth_from_user

string

No

Optional

Specify user in a from field instead of CallerID (overrides CallerID).
Some equipment require from; to be equivalent to Auth user.

auth_from_domain

string

No

Optional

Sets default from domain in SIP messages. Some equipment may require specific From Domain.

sst_refresh_method_id

integer

No

Optional

SIP method which will be used for session update.
See RFC 4028 for more details. Possible values:
1 - Invite
2 - Update
3 - Update fallback Invite

sip_timer_b

integer

No

Optional

INVITE transaction timeout (Default 8000ms).
See RFC 3261 Section 17.1.1.2 for more details.

dns_srv_failover_timer

integer

No

Optional

Invite transaction timeout for each of gateways with DNS SRV rerouting (Default 2000ms).

rtp_ping

boolean

No

Optional

Use RTP PING when connecting a call.
After establishing the call, DIDWW will send empty RTP packet RTP PING.
It is necessary if both parties operate in Symmetric RTP / Comedia mode and expect the other party to start sending RTP first.

rtp_timeout

integer

No

Optional

Disconnect the call if the RTP packets do not arrive within the specified time.

sst_min_timer

integer

No

Optional

Minimal SIP Session timer value (Default 600 seconds).
See RFC 4028 for more details.

sst_max_timer

integer

No

Optional

Maximal SIP Session timer value (Default 900 seconds)..
See RFC 4028 for more details.

sst_session_expires

integer

No

Optional

Session-Expires header value. Optional, should be in range with sst_min_timer and sst_max_timer..
See RFC 4028 for more details.

port

integer

No

Optional

Port part of R-URI in INVITE request (is not mandatory).
If port is null, SRV record will be resolved (or A record if SRV is unavailable).

rx_dtmf_format_id

integer

No

Optional

The method id for receiving DTMF signals from customers equipment.
Possible values:
1 - RFC 2833
2 - SIP INFO application/dtmf-relay OR application/dtmf
3 - RFC 2833 OR SIP INFO

tx_dtmf_format_id

integer

No

Optional

The method of sending DTMF signals to customers equipment.
Possible values:
1 - Disable sending
2 - RFC 2833
3 - SIP INFO application/dtmf-relay
4 - SIP INFO application/dtmf

force_symmetric_rtp

boolean

No

Optional

Forced to work in Symmetric RTP / COMEDIA mode.

symmetric_rtp_ignore_rtcp

boolean

No

Optional

Avoid switching RTP session based on RTCP packet while working in Symmetric RTP / COMEDIA.
Only RTP packets will be considered.

sst_enabled

boolean

No

Optional

Enable SIP Session timers customization.
SIP session timers are used to make sure that a session (dialog) is still alive,
even though there may have been a long time since the last in-dialog message.
If the other end is not responding, the dialog will be hung up automatically.
SIP session timers need to be supported by all end points for it to work.
It’s a SIP extension, standardized by the IETF.
See RFC 4028 for more details.

sst_accept_501

boolean

No

Optional

Do not drop the call after receiving SIP 501 response for non-critical messages.

auth_enabled

boolean

No

Optional

Enable authorization for the SIP server.

resolve_ruri

boolean

No

Optional

Replace host part of the R-URI by resolved IP address.

rerouting_disconnect_code_ids

array

No

Optional

Rerouting disconnect codes .

codec_ids

array

No

Optional

Codecs

transport_protocol_id

integer

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

integer

No

Optional

Max count of the REFER requests.

max_30x_redirects

integer

No

Optional

Max count of 301/302 redirects.

Examples

http

PATCH /v3/trunks/57a939dd-1600-41a6-80b1-f624e22a1f4c HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API token]

{
  "data": {
    "id": "57a939dd-1600-41a6-80b1-f624e22a1f4c",
    "type": "trunks",
    "attributes": {
      "configuration": {
        "type": "sip_configurations",
        "attributes": {
          "username": "new_username"
        }
      }
    }
  }
}

curl

curl -i -X PATCH https://api.didww.com/v3/trunks/57a939dd-1600-41a6-80b1-f624e22a1f4c -H "Accept: application/vnd.api+json" -H "Api-Key: [API token]" -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"attributes": {"configuration": {"attributes": {"username": "new_username"}, "type": "sip_configurations"}}, "id": "57a939dd-1600-41a6-80b1-f624e22a1f4c", "type": "trunks"}}'

response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "57a939dd-1600-41a6-80b1-f624e22a1f4c",
    "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": "new_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/57a939dd-1600-41a6-80b1-f624e22a1f4c/relationships/trunk_group",
          "related": "https://api.didww.com/v3/trunks/57a939dd-1600-41a6-80b1-f624e22a1f4c/trunk_group"
        }
      },
      "pop": {
        "links": {
          "self": "https://api.didww.com/v3/trunks/57a939dd-1600-41a6-80b1-f624e22a1f4c/relationships/pop",
          "related": "https://api.didww.com/v3/trunks/57a939dd-1600-41a6-80b1-f624e22a1f4c/pop"
        }
      }
    }
  },
  "meta": {
    "api_version": "2017-09-18"
  }
}

Other Responses

Code

Success

Description

404

No

Not Found

401

No

Unauthorized