Create a Dialing Context

Complete these tasks to create a dialing-context configuration element.

Table - Prerequisites

Prerequisite More Information
Authenticate Authenticate

This example assumes you have exported the access token to the variable $TOKEN.

  1. Retrieve the dialing-context template.

    The template of a configuration element is a data structure containing all required sub-elements and supported attributes with their default values, along with any specified optional sub-elements.

    curl -X GET -o response.xml \
        --header "Accept: application/xml" \
        --header "Authorization: Bearer $TOKEN" \
        "https://10.0.0.2/rest/v1.2/configuration/elementTypes/template?elementType=dialing-context&subElement=dial-pattern"
    The response is saved to the file response.xml.
  2. Copy the content between the opening and closing <configElement> tags to a new file called dialing-context.xml.

    If you are on a Linux system with xmllint installed, you may optionally format the XML before writing it to the file system.

    sed -n '/<configElement>/,/<\/configElement>/p' response.xml | xmllint --format - > dialing-context.xml
  3. Set the attributes in the XML file to their desired values.

    The following shows an example of the contents of dialing-context.xml:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <configElement>
      <elementType>dialing-context</elementType>
      <attribute>
        <name>name</name>
        <value/>
      </attribute>
      <attribute>
        <name>parent</name>
        <value/>
      </attribute>
      <attribute>
        <name>type</name>
        <value>corporate</value>
      </attribute>
      <attribute>
        <name>geographic-location</name>
        <value/>
      </attribute>
      <attribute>
        <name>description</name>
        <value/>
      </attribute>
      <attribute>
        <name>country-code</name>
        <value/>
      </attribute>
      <attribute>
        <name>outside-line-prefix</name>
        <value/>
      </attribute>
      <subElement>
        <subElementType>dial-pattern</subElementType>
        <attribute>
          <name>remove-prefix</name>
          <value/>
        </attribute>
        <attribute>
          <name>pattern</name>
          <value/>
        </attribute>
        <attribute>
          <name>description</name>
          <value/>
        </attribute>
        <attribute>
          <name>country-code</name>
          <value/>
        </attribute>
        <attribute>
          <name>replacement-prefix</name>
          <value/>
        </attribute>
        <attribute>
          <name>replacement-uri</name>
          <value/>
        </attribute>
        <attribute>
          <name>go-to-context</name>
          <value/>
        </attribute>
      </subElement>
    </configElement>
  4. Acquire the configuration lock.
    curl -X POST \
        --header "Accept: application/xml" \
        --header "Authorization: Bearer $TOKEN" \
        "https://10.0.0.2/rest/v1.2/configuration/lock"
  5. Add the dialing-context configuration element to the Communications Broker.
    curl -X POST \
        -d@dialing-context.xml \
        --header "Accept: application/xml" \
        --header "Authorization: Bearer $TOKEN" \
        "https://10.0.0.2/rest/v1.2/configuration/configElements"
  6. If done editing the configuration, save, verify, and activate the configuration.
  7. Release the configuration lock.
    curl -X POST \
        --header "Accept: application/xml" \
        --header "Authorization: Bearer $TOKEN" \
        "https://10.0.0.2/rest/v1.2/configuration/unlock"