Create Voice OUT Trunk

Description

Creates a voice out trunk.

Request

HTTP Method: POST

URI Path: /v3/voice_out_trunks

Body Parameters:

Name

Type

Nullable

Is Required?

Description

type

string

No

Yes

Trunks

attributes

object

No

Yes

Trunk configuration complex object.

Data Attributes:

Name

Type

Nullable

Is Required?

Description

name

string

No

Yes

The voice out trunk name.

allowed_sip_ips

Array of strings

No

Yes

The allowed originating IPs. Array from 0 to 15 items: IP v4/v6 single or subnet.

allowed_rtp_ips

Array of strings

Yes

No

The allowed RTP IPs. Array from 0 to 10 items: IP v4/v6 single or subnet.

on_cli_mismatch_action

string

No

Yes

Possible values are:
send_original_cli - the system will pass the FROM header value to the termination gateway.
replace_cli - the system will replace the FROM header value to the specified value in default_did relationship.
reject_call - the system will reject the call if the FROM header value does not match any of the allowed DIDs.

capacity_limit

integer

Yes

No

The capacity limit of the voice out trunk. Allowed values from 0 to 32767.

allow_any_did_as_cli

boolean

No

No

When set to True, passed than DIDs relationship can not be set to explicit DIDs. if DIDs relationship is omitted in payload already linked DIDs will be automatically unassigned.
Default value is False.

status

string

No

No

Can be either: Active or Blocked. If set to null, the default value is Active.

threshold_amount

string

Yes

No

The outbound trunk 24 hour threshold limit. Can be from 0.0 to 100000.0.

default_dst_action

string

No

No

Can be either: allow_all or reject_all.

dst_prefixes

string

Yes

No

The allowed destination prefixes.

media_encryption_mode

string

No

No

Media encryption mode.
See RFC4568 about SRTP SDES, RFC5764 about SRTP DTLS, and RFC6189 about ZRTP for more details.
Possible values:
‘disabled’ - Disabled
‘srtp_sdes’ - SRTP SDES
‘srtp_dtls’ - SRTP DTLS
‘zrtp’ - ZRTP

callback_url

string

Yes

No

Can be null or valid HTTP(s) URL.

Request Body Object Relationships:

Title

Type

Description

default did

DIDs

The DID number if on_cli_mismatch_action is set to replace_cli.

dids

DIDs

The DID numbers if allow_any_did_as_cli is set to false.

Examples

http

POST /v3/voice_out_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": "voice_out_trunks",
    "attributes": {
      "name": "Outbound trunk 11",
      "allowed_sip_ips": ["192.168.1.1"],
      "on_cli_mismatch_action": "send_original_cli",
      "capacity_limit": 100,
      "allow_any_did_as_cli": true,
      "status": "active",
      "threshold_amount": "9999.0",
      "default_dst_action": "allow_all",
      "dst_prefixes": ["23"],
      "media_encryption_mode": "disabled",
      "allowed_rtp_ips": ["192.168.1.1"],
      "force_symmetric_rtp": false,
      "rtp_ping": false
    }
  }
}

curl

curl -i -X POST https://api.didww.com/v3/voice_out_trunks -H 'Accept: application/vnd.api+json' -H 'Api-Key: [API token]' -H 'Content-Type: application/vnd.api+json' --data-raw '{"data": {"attributes": {"allow_any_did_as_cli": true, "allowed_rtp_ips": ["192.168.1.1"], "allowed_sip_ips": ["192.168.1.1"], "capacity_limit": 100, "default_dst_action": "allow_all", "dst_prefixes": ["23"], "force_symmetric_rtp": false, "media_encryption_mode": "disabled", "name": "Outbound trunk 11", "on_cli_mismatch_action": "send_original_cli", "rtp_ping": false, "status": "active", "threshold_amount": "9999.0"}, "type": "voice_out_trunks"}}'

response

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

{
  "data": {
    "id": "d471975a-c6ee-4f84-80f0-fad67c5e22b1",
    "type": "voice_out_trunks",
    "attributes": {
      "allowed_sip_ips": [
        "192.168.1.1/32"
      ],
      "allowed_rtp_ips": [
        "192.168.1.1/32"
      ],
      "allow_any_did_as_cli": true,
      "status": "active",
      "on_cli_mismatch_action": "send_original_cli",
      "name": "Outbound trunk 11",
      "capacity_limit": 100,
      "username": "euc******",
      "password": "6fw******",
      "created_at": "2021-12-02T07:17:40.125Z",
      "threshold_reached": false,
      "threshold_amount": "9999.0",
      "media_encryption_mode": "disabled",
      "default_dst_action": "allow_all",
      "dst_prefixes": [
        "23"
      ],
      "force_symmetric_rtp": false,
      "rtp_ping": false,
      "callback_url": null
    },
    "relationships": {
      "default_did": {
        "links": {
          "self": "https://api.didww.com/v3/voice_out_trunks/d471975a-c6ee-4f84-80f0-fad67c5e22b1/relationships/default_did",
          "related": "https://api.didww.com/v3/voice_out_trunks/d471975a-c6ee-4f84-80f0-fad67c5e22b1/default_did"
        }
      },
      "dids": {
        "links": {
          "self": "https://api.didww.com/v3/voice_out_trunks/d471975a-c6ee-4f84-80f0-fad67c5e22b1/relationships/dids",
          "related": "https://api.didww.com/v3/voice_out_trunks/d471975a-c6ee-4f84-80f0-fad67c5e22b1/dids"
        }
      }
    },
    "meta": {
      "spent_amount": "0.0"
    }
  },
  "meta": {
    "api_version": "2021-12-15"
  }
}

http

POST /v3/voice_out_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": "voice_out_trunks",
    "attributes": {
      "name": "Outbound replace cli",
      "allowed_sip_ips": [
        "192.168.1.1"
      ],
      "on_cli_mismatch_action": "replace_cli",
      "capacity_limit": 300,
      "allow_any_did_as_cli": true,
      "status": "blocked",
      "threshold_amount": "1000.0",
      "default_dst_action": "allow_all",
      "dst_prefixes": [
        "23",
        "45"
      ],
      "media_encryption_mode": "disabled",
      "allowed_rtp_ips": [
        "192.168.1.1"
      ],
      "force_symmetric_rtp": true,
      "callback_url": "http://10.201.10.1/test.php",
      "rtp_ping": true
    },
    "relationships": {
      "default_did": {
        "data": {
          "type": "dids",
          "id": "e144b6a4-24d2-4ee4-8b13-07a04edc448b"
        }
      }
    }
  }
}

curl

curl -i -X POST https://api.didww.com/v3/voice_out_trunks -H 'Accept: application/vnd.api+json' -H 'Api-Key: [API token]' -H 'Content-Type: application/vnd.api+json' --data-raw '{"data": {"attributes": {"allow_any_did_as_cli": true, "allowed_rtp_ips": ["192.168.1.1"], "allowed_sip_ips": ["192.168.1.1"], "callback_url": "http://10.201.10.1/test.php", "capacity_limit": 300, "default_dst_action": "allow_all", "dst_prefixes": ["23", "45"], "force_symmetric_rtp": true, "media_encryption_mode": "disabled", "name": "Outbound replace cli", "on_cli_mismatch_action": "replace_cli", "rtp_ping": true, "status": "blocked", "threshold_amount": "1000.0"}, "relationships": {"default_did": {"data": {"id": "e144b6a4-24d2-4ee4-8b13-07a04edc448b", "type": "dids"}}}, "type": "voice_out_trunks"}}'

response

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

{
  "data": {
    "id": "138a6765-bd54-4814-8ce7-35adc524e1fb",
    "type": "voice_out_trunks",
    "attributes": {
      "allowed_sip_ips": [
        "192.168.1.1/32"
      ],
      "allowed_rtp_ips": [
        "192.168.1.1/32"
      ],
      "allow_any_did_as_cli": true,
      "status": "blocked",
      "on_cli_mismatch_action": "replace_cli",
      "name": "Outbound replace cli",
      "capacity_limit": 300,
      "username": "p2********",
      "password": "88********",
      "created_at": "2022-01-12T18:13:55.417Z",
      "threshold_reached": false,
      "threshold_amount": "1000.0",
      "media_encryption_mode": "disabled",
      "default_dst_action": "allow_all",
      "dst_prefixes": [
        "23",
        "45"
      ],
      "force_symmetric_rtp": true,
      "rtp_ping": true,
      "callback_url": "http://10.201.10.1/test.php"
    },
    "relationships": {
      "default_did": {
        "links": {
          "self": "https://api.didww.com/v3/voice_out_trunks/138a6765-bd54-4814-8ce7-35adc524e1fb/relationships/default_did",
          "related": "https://api.didww.com/v3/voice_out_trunks/138a6765-bd54-4814-8ce7-35adc524e1fb/default_did"
        }
      },
      "dids": {
        "links": {
          "self": "https://api.didww.com/v3/voice_out_trunks/138a6765-bd54-4814-8ce7-35adc524e1fb/relationships/dids",
          "related": "https://api.didww.com/v3/voice_out_trunks/138a6765-bd54-4814-8ce7-35adc524e1fb/dids"
        }
      }
    },
    "meta": {
      "spent_amount": "0.0"
    }
  },
  "meta": {
    "api_version": "2021-12-15"
  }
}

http

POST /v3/voice_out_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": "voice_out_trunks",
    "attributes": {
      "name": "Outbound trunk 100",
      "allowed_sip_ips": [
        "192.168.1.1"
      ],
      "on_cli_mismatch_action": "replace_cli",
      "capacity_limit": 300,
      "allow_any_did_as_cli": false,
      "status": "active",
      "threshold_amount": "1000.0",
      "default_dst_action": "allow_all",
      "dst_prefixes": [],
      "media_encryption_mode": "disabled",
      "allowed_rtp_ips": [
        "192.168.1.1"
      ],
      "force_symmetric_rtp": false,
      "callback_url": "http://10.201.10.1/test.php",
      "rtp_ping": false
    },
    "relationships": {
      "default_did": {
        "data": {
          "type": "dids",
          "id": "7a6c177d-a054-4c75-9b4c-b1596ed6fa25"
        }
      },
      "dids": {
        "data": [
          {
            "type": "dids",
            "id": "7a6c177d-a054-4c75-9b4c-b1596ed6fa25"
          }
        ]
      }
    }
  }
}

curl

curl -i -X POST https://api.didww.com/v3/voice_out_trunks -H 'Accept: application/vnd.api+json' -H 'Api-Key: [API token]' -H 'Content-Type: application/vnd.api+json' --data-raw '{"data": {"attributes": {"allow_any_did_as_cli": false, "allowed_rtp_ips": ["192.168.1.1"], "allowed_sip_ips": ["192.168.1.1"], "callback_url": "http://10.201.10.1/test.php", "capacity_limit": 300, "default_dst_action": "allow_all", "dst_prefixes": [], "force_symmetric_rtp": false, "media_encryption_mode": "disabled", "name": "Outbound trunk 100", "on_cli_mismatch_action": "replace_cli", "rtp_ping": false, "status": "active", "threshold_amount": "1000.0"}, "relationships": {"default_did": {"data": {"id": "7a6c177d-a054-4c75-9b4c-b1596ed6fa25", "type": "dids"}}, "dids": {"data": [{"type": "dids", "id": "7a6c177d-a054-4c75-9b4c-b1596ed6fa25"}]}}, "type": "voice_out_trunks"}}'

response

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

{
    "data": {
        "id": "2680024e-b2a1-4175-a1ec-8f40ea144e64",
        "type": "voice_out_trunks",
        "attributes": {
            "allowed_sip_ips": [
                "192.168.1.1/32"
            ],
            "allowed_rtp_ips": [
                "192.168.1.1/32"
            ],
            "allow_any_did_as_cli": false,
            "status": "active",
            "on_cli_mismatch_action": "replace_cli",
            "name": "Outbound trunk 100",
            "capacity_limit": 300,
            "username": "ok********",
            "password": "m1********",
            "created_at": "2022-03-03T09:29:20.694Z",
            "threshold_reached": false,
            "threshold_amount": "1000.0",
            "media_encryption_mode": "disabled",
            "default_dst_action": "allow_all",
            "dst_prefixes": [],
            "force_symmetric_rtp": false,
            "rtp_ping": false,
            "callback_url": "http://10.201.10.1/test.php"
        },
        "relationships": {
            "default_did": {
                "links": {
                    "self": "https://api.didww.com/v3/voice_out_trunks/2680024e-b2a1-4175-a1ec-8f40ea144e64/relationships/default_did",
                    "related": "https://api.didww.com/v3/voice_out_trunks/2680024e-b2a1-4175-a1ec-8f40ea144e64/default_did"
                }
            },
            "dids": {
                "links": {
                    "self": "https://api.didww.com/v3/voice_out_trunks/2680024e-b2a1-4175-a1ec-8f40ea144e64/relationships/dids",
                    "related": "https://api.didww.com/v3/voice_out_trunks/2680024e-b2a1-4175-a1ec-8f40ea144e64/dids"
                }
            }
        },
        "meta": {
            "spent_amount": "0.0"
        }
    },
    "meta": {
        "api_version": "2021-12-15"
    }
}

Other Responses

Code

Success

Description

422

No

Unprocessable Entity

401

No

Unauthorized