Chilkat Online Tools

TCL / Zoom API / Assign SIP trunk configuration

Back to Collection Items

load ./chilkat.dll

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_CkHttp]

set req [new_CkHttpRequest]

CkHttpRequest_put_HttpVerb $req "PATCH"
CkHttpRequest_put_Path $req "/v2/accounts/:accountId/sip_trunk/settings"
CkHttpRequest_put_ContentType $req "multipart/form-data"
CkHttpRequest_AddParam $req "enable" "false"

CkHttpRequest_AddParam $req "show_callout_internal_number" "falsefalse"

CkHttpRequest_AddParam $req "show_zoom_provided_callout_countries" "falsefalse50968347"

CkHttpRequest_AddParam $req "show_zoom_provided_numbers" "falsefalse509683472"

CkHttpRequest_AddHeader $req "Authorization" "Bearer <access_token>"

# resp is a CkHttpResponse
set resp [CkHttp_SynchronousRequest $http "api.zoom.us" 443 1 $req]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkHttpRequest $req
    exit
}

set sbResponseBody [new_CkStringBuilder]

CkHttpResponse_GetBodySb $resp $sbResponseBody

set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkHttpRequest $req
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkHttpRequest $req
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp

Curl Command

curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'enable=false'
	--form 'show_callout_internal_number=falsefalse'
	--form 'show_zoom_provided_callout_countries=falsefalse50968347'
	--form 'show_zoom_provided_numbers=falsefalse509683472'
https://api.zoom.us/v2/accounts/:accountId/sip_trunk/settings

Postman Collection Item JSON

{
  "name": "Assign SIP trunk configuration",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "PATCH",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "enable",
          "value": "false",
          "description": "Assign or delete the SIP configuration:\n\n* `true` — Assign the Master account's SIP configuration information to the subaccount.\n* `false` — Delete the subaccount's assigned SIP configuration.\n\nIf you do **not** query this parameter, the API will **not** modify the subaccount's configuration.",
          "type": "text"
        },
        {
          "key": "show_callout_internal_number",
          "value": "false",
          "description": "If the value of this option is set to `true`, the call-out numbers provided by the Zoom carrier partners will be displayed in the account's list of available call-out numbers in the Zoom Web Portal and Zoom Client.",
          "type": "text"
        },
        {
          "key": "show_zoom_provided_callout_countries",
          "value": "50968347",
          "description": "If the value of this option is set to `0`, the call-out countries list provided by Zoom will be [displayed](https://support.zoom.us/hc/en-us/articles/200942859-Using-telephone-call-out) in the account's list of available call-out countries. \n\nIf the value of this option is set to `1`, the Zoom provided call-out countries will be hidden from the user's account.<br> \n\nIf the value of this option is set to `2`, all Zoom provided countries will be deleted and only internal countries (provided by carrier partners) will be used.",
          "type": "text"
        },
        {
          "key": "show_zoom_provided_numbers",
          "value": "2",
          "description": "If the value of this option is set to `0`, the numbers provided by Zoom will be displayed in the account's list of available call-out and call-in numbers in the Zoom Web Portal and Zoom Client. \n\nIf the value of this option is set to `1`, the Zoom provided numbers will be shown in the Zoom Web Portal but will not be used unless specified by the user.<br> \n\nIf the value of this option is set to `2`, all Zoom provided numbers will be deleted and only internal numbers (provided by carrier partners) will be used. (This can only be one of 0,1,2)",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/accounts/:accountId/sip_trunk/settings",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "accounts",
        ":accountId",
        "sip_trunk",
        "settings"
      ],
      "variable": [
        {
          "key": "accountId"
        }
      ]
    },
    "description": "Use this API to copy the Session Initiation Protocol (SIP) Connected Audio configurations applied on the Master account and enable or disable those configurations on a subaccount.\n\nWith SIP-connected audio, Zoom establishes a [SIP trunk](https://en.wikipedia.org/wiki/SIP_trunking) (a network connection specifically designed to make and deliver phone calls) over a direct and private connection between the customer’s network and the Zoom cloud. Meeting participants that dial into a meeting or have the meeting call them, and are On-Net from the perspective of the customers' IP telephony network, will be connected over this trunk rather than over the PSTN.\n\n**Scopes:** `sip_trunk:master`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`\n\n**Prerequisites:** \n* Pro or a higher account with SIP Connected Audio plan enabled. \n* A Master account owner"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `204` **No Content**<br>\nConfiguration assigned successfully.\n",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "enable",
              "value": "false",
              "description": "Assign or delete the SIP configuration:\n\n* `true` — Assign the Master account's SIP configuration information to the subaccount.\n* `false` — Delete the subaccount's assigned SIP configuration.\n\nIf you do **not** query this parameter, the API will **not** modify the subaccount's configuration.",
              "type": "text"
            },
            {
              "key": "show_callout_internal_number",
              "value": "false",
              "description": "If the value of this option is set to `true`, the call-out numbers provided by the Zoom carrier partners will be displayed in the account's list of available call-out numbers in the Zoom Web Portal and Zoom Client.",
              "type": "text"
            },
            {
              "key": "show_zoom_provided_callout_countries",
              "value": "50968347",
              "description": "If the value of this option is set to `0`, the call-out countries list provided by Zoom will be [displayed](https://support.zoom.us/hc/en-us/articles/200942859-Using-telephone-call-out) in the account's list of available call-out countries. \n\nIf the value of this option is set to `1`, the Zoom provided call-out countries will be hidden from the user's account.<br> \n\nIf the value of this option is set to `2`, all Zoom provided countries will be deleted and only internal countries (provided by carrier partners) will be used.",
              "type": "text"
            },
            {
              "key": "show_zoom_provided_numbers",
              "value": "2",
              "description": "If the value of this option is set to `0`, the numbers provided by Zoom will be displayed in the account's list of available call-out and call-in numbers in the Zoom Web Portal and Zoom Client. \n\nIf the value of this option is set to `1`, the Zoom provided numbers will be shown in the Zoom Web Portal but will not be used unless specified by the user.<br> \n\nIf the value of this option is set to `2`, all Zoom provided numbers will be deleted and only internal numbers (provided by carrier partners) will be used. (This can only be one of 0,1,2)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/sip_trunk/settings",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "sip_trunk",
            "settings"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "**HTTP Status Code:** `400` **Bad Request**<br>\n**Error Code:** `2100`<br>\nThis sub account has no sip trunk plan.",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "enable",
              "value": "false",
              "description": "Assign or delete the SIP configuration:\n\n* `true` — Assign the Master account's SIP configuration information to the subaccount.\n* `false` — Delete the subaccount's assigned SIP configuration.\n\nIf you do **not** query this parameter, the API will **not** modify the subaccount's configuration.",
              "type": "text"
            },
            {
              "key": "show_callout_internal_number",
              "value": "false",
              "description": "If the value of this option is set to `true`, the call-out numbers provided by the Zoom carrier partners will be displayed in the account's list of available call-out numbers in the Zoom Web Portal and Zoom Client.",
              "type": "text"
            },
            {
              "key": "show_zoom_provided_callout_countries",
              "value": "50968347",
              "description": "If the value of this option is set to `0`, the call-out countries list provided by Zoom will be [displayed](https://support.zoom.us/hc/en-us/articles/200942859-Using-telephone-call-out) in the account's list of available call-out countries. \n\nIf the value of this option is set to `1`, the Zoom provided call-out countries will be hidden from the user's account.<br> \n\nIf the value of this option is set to `2`, all Zoom provided countries will be deleted and only internal countries (provided by carrier partners) will be used.",
              "type": "text"
            },
            {
              "key": "show_zoom_provided_numbers",
              "value": "2",
              "description": "If the value of this option is set to `0`, the numbers provided by Zoom will be displayed in the account's list of available call-out and call-in numbers in the Zoom Web Portal and Zoom Client. \n\nIf the value of this option is set to `1`, the Zoom provided numbers will be shown in the Zoom Web Portal but will not be used unless specified by the user.<br> \n\nIf the value of this option is set to `2`, all Zoom provided numbers will be deleted and only internal numbers (provided by carrier partners) will be used. (This can only be one of 0,1,2)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/sip_trunk/settings",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "sip_trunk",
            "settings"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404` **Not Found**<br><br>\n**Error Code:** `2001`<br>\nThis account does not exist or does not belong to this master account.<br>\nThis account does not exist or does not belong to you.",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "enable",
              "value": "false",
              "description": "Assign or delete the SIP configuration:\n\n* `true` — Assign the Master account's SIP configuration information to the subaccount.\n* `false` — Delete the subaccount's assigned SIP configuration.\n\nIf you do **not** query this parameter, the API will **not** modify the subaccount's configuration.",
              "type": "text"
            },
            {
              "key": "show_callout_internal_number",
              "value": "false",
              "description": "If the value of this option is set to `true`, the call-out numbers provided by the Zoom carrier partners will be displayed in the account's list of available call-out numbers in the Zoom Web Portal and Zoom Client.",
              "type": "text"
            },
            {
              "key": "show_zoom_provided_callout_countries",
              "value": "50968347",
              "description": "If the value of this option is set to `0`, the call-out countries list provided by Zoom will be [displayed](https://support.zoom.us/hc/en-us/articles/200942859-Using-telephone-call-out) in the account's list of available call-out countries. \n\nIf the value of this option is set to `1`, the Zoom provided call-out countries will be hidden from the user's account.<br> \n\nIf the value of this option is set to `2`, all Zoom provided countries will be deleted and only internal countries (provided by carrier partners) will be used.",
              "type": "text"
            },
            {
              "key": "show_zoom_provided_numbers",
              "value": "2",
              "description": "If the value of this option is set to `0`, the numbers provided by Zoom will be displayed in the account's list of available call-out and call-in numbers in the Zoom Web Portal and Zoom Client. \n\nIf the value of this option is set to `1`, the Zoom provided numbers will be shown in the Zoom Web Portal but will not be used unless specified by the user.<br> \n\nIf the value of this option is set to `2`, all Zoom provided numbers will be deleted and only internal numbers (provided by carrier partners) will be used. (This can only be one of 0,1,2)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/sip_trunk/settings",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "sip_trunk",
            "settings"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}