Chilkat Online Tools

Node.js / Zoom API / Assign SIP trunk configuration

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    var req = new chilkat.HttpRequest();
    req.HttpVerb = "PATCH";
    req.Path = "/v2/accounts/:accountId/sip_trunk/settings";
    req.ContentType = "multipart/form-data";
    req.AddParam("enable","false");

    req.AddParam("show_callout_internal_number","falsefalse");

    req.AddParam("show_zoom_provided_callout_countries","falsefalse50968347");

    req.AddParam("show_zoom_provided_numbers","falsefalse509683472");

    req.AddHeader("Authorization","Bearer <access_token>");

    // resp: HttpResponse
    var resp = http.SynchronousRequest("api.zoom.us",443,true,req);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    var sbResponseBody = new chilkat.StringBuilder();
    resp.GetBodySb(sbResponseBody);

    var jResp = new chilkat.JsonObject();
    jResp.LoadSb(sbResponseBody);
    jResp.EmitCompact = false;

    console.log("Response Body:");
    console.log(jResp.Emit());

    var respStatusCode = resp.StatusCode;
    console.log("Response Status Code = " + respStatusCode);
    if (respStatusCode >= 400) {
        console.log("Response Header:");
        console.log(resp.Header);
        console.log("Failed.");

        return;
    }


}

chilkatExample();

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