<commit_before>---
title: Provisioning Telephony
description: This tutorial implements BYOC Cloud solution with a cloud-based carrier 
categories:
- Trunk
- Telephony
steps:
- title: Introduction
  content: |
    This tutorial walks through the steps on how to implement BYOC Cloud in Genesys Cloud using [Purecloud Platform API](https://developer.mypurecloud.com/api/rest/client-libraries/index.html). In order for BYOC Cloud to work with a third-party carrier, the carrier must:
    
    * Be SIP-compliant
    * Support the UDP or TCP trunk transport protocol
    * Have a publicly routable IP address or host name
      * Carriers must fully support Record-Routing as required by RFC 3261 to ensure proper routing of sequential SIP requests.
    
    For more information about carrier requirements, check Genesys Resource Center article [Carrier requirements for BYOC Cloud](https://help.mypurecloud.com/articles/carrier-requirements-byoc-cloud/).
    
    To successfully run the code, a JSON file is needed to provide the necessary input. In this tutorial, the JSON file is titled input-template.json.

- title: JSON Files and Variables
  content: |
    This file is used as substitute to input text box. This is where the user enters all the necessary details. Key value pair has its corresponding description. Please make sure to replace all the value of keys from description to actual data and fill all the required fields to proceed. 
    
    Please refer to [BYOC Cloud public SIP IP addresses](https://help.mypurecloud.com/articles/byoc-cloud-public-sip-ip-addresses/) for instance or Public SIP Addresses.  

- title: Authentication
  content: |
    Genesys Cloud will verify user's credentials using Client Credential authentication. Once the validation is successful, it will proceed with the succeeding process.

- title: Check BYOC Feature
  content: |
    Get the list of products available for the org used by calling [getAuthorizationProducts()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/AuthorizationApi.html#organizationproductentitylisting_getauthorizationproducts__) of Authorization API and check if the org has BYOC capability. If the org is BYOC capable, it will proceed to create location function.  Please take note that only BYOC enabled orgs can proceed.

- title: Create Location
  content: |
    Create a location in Genesys Cloud  by calling [postLocations()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/LocationsApi.html#postLocations) function of the locations API and save the returned location data in a global variable.

- title: Create Site
  content: |
    To create a new site, two pieces of information is needed. One is the location information, which is saved in a global variable and second is a default edge group which is found in PureCloud Admin > Telephony > Edge Groups.

    Get the default edge group by calling [getTelephonyProvidersEdgesSites()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#getTelephonyProvidersEdgesSites) function and look for "PureCloud Voice – AWS". Save the returned data and proceed to creating a new site with [postTelephonyProvidersEdgesSites()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#postTelephonyProvidersEdgesSites) function. Both functions are under telephony providers edge API.

- title: Create Trunk
  content: |
    Create a trunk base setting object from the user input credentials from the JSON file by calling [postTelephonyProvidersEdgesTrunkbasesettings()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#trunkbase_posttelephonyprovidersedgestrunkbasesettings_body_) of Telephony Providers Edge API. Once the trunk is successfully created, it will proceed to siteOutboundRoutes function. 

- title: Set Outbound Route
  content: |
    Lastly, with the use of telephony providers edge API, get the outbound route created by default when the site was created using [getTelephonyProvidersEdgesSiteOutboundroutes()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#getTelephonyProvidersEdgesSiteOutboundroutes) function, then update the external trunk base value of the trunk created in the previous step by calling [putTelephonyProvidersEdgesSiteOutboundroutes()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#putTelephonyProvidersEdgesEdgegroupEdgetrunkbase) function.

languages:
  nodejs:
    displayName: NodeJS
    steps:
    - file: "nodejs/index.js"
      highlight: "0-331"
    - file: "nodejs/input-template.json"
      highlight: "1-32"
    - file: "nodejs/index.js"
      highlight: "15-25"<commit_msg>Update config.yml<commit_after>---
title: Provisioning Telephony
description: This tutorial implements BYOC Cloud solution with a cloud-based carrier 
categories:
- Trunk
- Telephony
steps:
- title: Introduction
  content: |
    This tutorial walks through the steps on how to implement BYOC Cloud in Genesys Cloud using [Purecloud Platform API](https://developer.mypurecloud.com/api/rest/client-libraries/index.html). In order for BYOC Cloud to work with a third-party carrier, the carrier must:
    
    * Be SIP-compliant
    * Support the UDP or TCP trunk transport protocol
    * Have a publicly routable IP address or host name
      * Carriers must fully support Record-Routing as required by RFC 3261 to ensure proper routing of sequential SIP requests.
    
    For more information about carrier requirements, check Genesys Resource Center article [Carrier requirements for BYOC Cloud](https://help.mypurecloud.com/articles/carrier-requirements-byoc-cloud/).
    
    To successfully run the code, a JSON file is needed to provide the necessary input. In this tutorial, the JSON file is titled input-template.json.

- title: JSON Files and Variables
  content: |
    This file is used as substitute to input text box. This is where the user enters all the necessary details. Key value pair has its corresponding description. Please make sure to replace all the value of keys from description to actual data and fill all the required fields to proceed. 
    
    Please refer to [BYOC Cloud public SIP IP addresses](https://help.mypurecloud.com/articles/byoc-cloud-public-sip-ip-addresses/) for instance or Public SIP Addresses.  

- title: Authentication
  content: |
    Genesys Cloud will verify user's credentials using Client Credential authentication. Once the validation is successful, it will proceed with the succeeding process.

- title: Check BYOC Feature
  content: |
    Get the list of products available for the org used by calling [getAuthorizationProducts()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/AuthorizationApi.html#organizationproductentitylisting_getauthorizationproducts__) function of Authorization API and check if the org has BYOC capability. If the org is BYOC capable, it will proceed to create location function.  Please take note that only BYOC enabled orgs can proceed.

- title: Create Location
  content: |
    Create a location in Genesys Cloud  by calling [postLocations()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/LocationsApi.html#postLocations) function of the locations API and save the returned location data in a global variable.

- title: Create Site
  content: |
    To create a new site, two pieces of information is needed. One is the location information, which is saved in a global variable and second is a default edge group which is found in PureCloud Admin > Telephony > Edge Groups.

    Get the default edge group by calling [getTelephonyProvidersEdgesSites()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#getTelephonyProvidersEdgesSites) function and look for "PureCloud Voice – AWS". Save the returned data and proceed to creating a new site with [postTelephonyProvidersEdgesSites()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#postTelephonyProvidersEdgesSites) function. Both functions are under telephony providers edge API.

- title: Create Trunk
  content: |
    Create a trunk base setting object from the user input credentials from the JSON file by calling [postTelephonyProvidersEdgesTrunkbasesettings()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#trunkbase_posttelephonyprovidersedgestrunkbasesettings_body_) of Telephony Providers Edge API. Once the trunk is successfully created, it will proceed to siteOutboundRoutes function. 

- title: Set Outbound Route
  content: |
    Lastly, with the use of telephony providers edge API, get the outbound route created by default when the site was created using [getTelephonyProvidersEdgesSiteOutboundroutes()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#getTelephonyProvidersEdgesSiteOutboundroutes) function, then update the external trunk base value of the trunk created in the previous step by calling [putTelephonyProvidersEdgesSiteOutboundroutes()](https://developer.mypurecloud.com/api/rest/client-libraries/javascript/TelephonyProvidersEdgeApi.html#putTelephonyProvidersEdgesEdgegroupEdgetrunkbase) function.

languages:
  nodejs:
    displayName: NodeJS
    steps:
    - file: "nodejs/index.js"
      highlight: "0-331"
    - file: "nodejs/input-template.json"
      highlight: "1-32"
    - file: "nodejs/index.js"
      highlight: "15-25"
{'fraction_non_alphanumeric': 0.06441306812326085, 'fraction_numerical': 0.0030918272699165207, 'mean_word_length': 4.748815165876778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '344136', 'n_tokens_mistral': 2572, 'n_tokens_neox': 2478, 'n_words': 987}