Chilkat Online Tools

autoit / Zoom API / Assign SIP trunk configuration

Back to Collection Items

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

$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess

$oReq = ObjCreate("Chilkat.HttpRequest")
$oReq.HttpVerb = "PATCH"
$oReq.Path = "/v2/accounts/:accountId/sip_trunk/settings"
$oReq.ContentType = "multipart/form-data"
$oReq.AddParam "enable","false"

$oReq.AddParam "show_callout_internal_number","falsefalse"

$oReq.AddParam "show_zoom_provided_callout_countries","falsefalse50968347"

$oReq.AddParam "show_zoom_provided_numbers","falsefalse509683472"

$oReq.AddHeader "Authorization","Bearer <access_token>"

Local $oResp = $oHttp.SynchronousRequest("api.zoom.us",443,True,$oReq)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)

$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oResp.Header & @CRLF)
    ConsoleWrite("Failed." & @CRLF)

    Exit
EndIf

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": ""
    }
  ]
}