Hc_np_add_number

Команда позволяет добавить номер в план нумерации виртуальной АТС.

Аналог команды в CoCon:

domain/<DOMAIN>/np/numbers/add

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/np_add_number

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- <error> -->
  <xs:complexType name="npErrorType">
    <xs:attribute name="cmd" type="xs:token" use="required" />
    <xs:attribute name="reason" type="xs:string" use="required" />
    <xs:attribute name="body" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
    <xs:attribute name="entity" type="xs:normalizedString" use="optional" />
  </xs:complexType>
  <!-- </error> -->

  <!-- Error reasons description -->
  <xs:simpleType name="npErrorReasonType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="not_exists" />
      <xs:enumeration value="unknown_error" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>
  <!-- End of error reasons description -->

  <!-- Error reasons description -->
  <xs:simpleType name="npNumberResultType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ok" />
      <xs:enumeration value="already_added" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>
  <!-- End of error reasons description -->

  <xs:complexType name="npResult">
    <xs:sequence>
      <xs:element name="number" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="result" type="npNumberResultType"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="npSuccess">
    <xs:sequence>
      <xs:element name="np" type="npResult" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="npErrors">
    <xs:sequence>
      <xs:element name="np" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="reason" type="npErrorReasonType"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="npNumberingPlan">
    <xs:sequence>
      <xs:element name="number" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use = "required"/>
  </xs:complexType>

  <xs:complexType name="npList">
    <xs:sequence>
      <xs:element name="np" type="npNumberingPlan" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
        <xs:element name="request">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_list" type="npList"/>
            </xs:sequence>
            <xs:attribute name="domain" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:choice>
        <!--Positive case-->
        <xs:element name="response">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="success" type="npSuccess"/>
              <xs:element name="errors" type="npErrors"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="npErrorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

CODE

Пример:

Запрос: http://192.168.1.21:9999/commands/np_add_number

<?xml version="1.0"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_add_number.xsd">
    <request domain="biysk.local">
        <np_list>
            <np name="np_240">
                <number name="415800"/>
                <number name="333333"/>
            </np>
            <np name="city">
                <number name="240500"/>
                <number name="240318"/>
            </np>
        </np_list>
    </request>
</in>
CODE

Ответ:200

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_add_number.xsd">
    <response>
        <success>
            <np name="np_240">
                <number name="415800" result="already_added"/>
                <number name="333333" result="ok"/>
            </np>
            <np name="city">
                <number name="240500" result="ok"/>
                <number name="240318" result="ok"/>
            </np>
        </success>
        <errors/>
    </response>
</out>
CODE

Hc_np_delete_number2

Команда позволяет удалить номер из плана нумерации виртуальной АТС.

Аналог команды в CoCon:

domain/<DOMAIN>/np/numbers/delete

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/np_delete_number2

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- <error> -->
  <xs:complexType name="npErrorType">
    <xs:attribute name="cmd" type="xs:token" use="required" />
    <xs:attribute name="reason" type="xs:string" use="required" />
    <xs:attribute name="body" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
    <xs:attribute name="entity" type="xs:normalizedString" use="optional" />
  </xs:complexType>
  <!-- </error> -->

  <!-- Error reasons description -->
  <xs:simpleType name="npErrorReasonType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="not_exists" />
      <xs:enumeration value="unknown_error" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>
  <!-- End of error reasons description -->

  <!-- Error reasons description -->
  <xs:simpleType name="npNumberResultType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ok" />
      <xs:enumeration value="not_exists" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>
  <!-- End of error reasons description -->

  <xs:complexType name="npResult">
    <xs:sequence>
      <xs:element name="number" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="result" type="npNumberResultType"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="npSuccess">
    <xs:sequence>
      <xs:element name="np" type="npResult" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="npErrors">
    <xs:sequence>
      <xs:element name="np" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="reason" type="npErrorReasonType"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="npNumberingPlan">
    <xs:sequence>
      <xs:element name="number" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use = "required"/>
  </xs:complexType>

  <xs:complexType name="npList">
    <xs:sequence>
      <xs:element name="np" type="npNumberingPlan" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
        <xs:element name="request">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_list" type="npList"/>
            </xs:sequence>
            <xs:attribute name="domain" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:choice>
        <!--Positive case-->
        <xs:element name="response">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="success" type="npSuccess"/>
              <xs:element name="errors" type="npErrors"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="npErrorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

CODE

Пример:

Запрос: http://192.168.1.21:9999/commands/np_delete_number2

<?xml version="1.0"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_delete_number2.xsd">
    <request domain="biysk.local">
        <np_list>
            <np name="np_240">
                <number name="333333"/>
                <number name="444000"/>
            </np>
            <np name="city">
                <number name="240318"/>
                <number name="240500"/>
            </np>
        </np_list>
    </request>
</in>
CODE

Ответ 200:

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_delete_number2.xsd">
    <response>
        <success>
            <np name="np_240">
                <number name="333333" result="ok"/>
                <number name="444000" result="not_exists"/>
            </np>
            <np name="city">
                <number name="240318" result="ok"/>
                <number name="240500" result="ok"/>
            </np>
        </success>
        <errors/>
    </response>
</out>
CODE

Hc_np_rename_number

Команда позволяет переименовать указанные номера в плане нумерации.

Аналог команды в CoCon:

domain/<DOMAIN>/np/numbers/rename

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/np_rename_number

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- <error> -->
  <xs:complexType name="npErrorType">
    <xs:attribute name="cmd" type="xs:token" use="required" />
    <xs:attribute name="reason" type="npErrorReasonType" use="required" />
    <xs:attribute name="body" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
    <xs:attribute name="entity" type="xs:normalizedString" use="optional" />
  </xs:complexType>
  <!-- </error> -->

  <!-- Error reasons description -->
  <xs:simpleType name="npErrorReasonType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="not_exists" />
      <xs:enumeration value="conflict_numbers" />
      <xs:enumeration value="unknown_error" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>
  <!-- End of error reasons description -->

  <xs:simpleType name="npRenameResultStrType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ok" />
      <xs:enumeration value="not_exists" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="NPRenameResultType">
    <xs:attribute name="old_value" type="xs:string" use="required"/>
    <xs:attribute name="new_value" type="xs:string" use="required"/>
    <xs:attribute name="result" type="npRenameResultStrType" use="required"/>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
        <xs:element name="request">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_number" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="old_value" type="xs:string" use="required"/>
                  <xs:attribute name="new_value" type="xs:string" use="required"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="domain" type="xs:string" use="required"/>
            <xs:attribute name="np_name" type="xs:string" use = "required"/>
          </xs:complexType>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>
  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:choice>
        <!--Positive case-->
        <xs:element name="response">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_number" type="NPRenameResultType" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="npErrorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

CODE

Запрос: http://192.168.1.21:9999/commands/np_rename_number

<?xml version="1.0"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_rename_number.xsd">
    <request domain="biysk.test" np_name="new">
        <np_number old_value="800" new_value="2800"/>
        <np_number old_value="900" new_value="2900"/>
    </request>
</in>
CODE

Ответ 200:

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_rename_number.xsd">
    <response>
        <np_number old_value="900" new_value="2900" result="ok"/>
        <np_number old_value="800" new_value="2800" result="ok"/>
    </response>
</out>
CODE

Hc_np_list_number

Команда просмотра списка номеров в плане нумерации и ресурсов, которые к ним привязаны.

Аналог команды в CoCon:

domain/<DOMAIN>/np/numbers/list

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/np_list_number

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- <error> -->
  <xs:complexType name="npErrorType">
    <xs:attribute name="cmd" type="xs:token" use="required" />
    <xs:attribute name="reason" type="npErrorReasonType" use="required" />
    <xs:attribute name="body" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
    <xs:attribute name="entity" type="xs:normalizedString" use="optional" />
  </xs:complexType>
  <!-- </error> -->

  <!-- Error reasons description -->
  <xs:simpleType name="npErrorReasonType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="not_exists" />
      <xs:enumeration value="unknown_error" />
      <!-- More reasons can be added here -->
    </xs:restriction>
  </xs:simpleType>
  <!-- End of error reasons description -->

  <xs:complexType name="NPNumberType">
    <xs:choice minOccurs="0" maxOccurs="1">
      <xs:element name="bridge">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="aliases">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="alias" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="iface" type="xs:string" use="required"/>
                <xs:attribute name="name" type="xs:string" use="required"/>
              </xs:complexType>
            </xs:element>
            </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:choice>
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="npType">
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="npList">
    <xs:sequence>
      <xs:element name="np" type="npType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="npInfo">
    <xs:sequence>
      <xs:element name="np_number" type="NPNumberType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="npResult">
    <xs:sequence>
      <xs:element name="np" type="npInfo" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
        <xs:element name="request">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_list" type="npList" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="domain" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:choice>
        <!--Positive case-->
        <xs:element name="response">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_list" type="npResult"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="npErrorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

CODE

Пример:

Запрос: http://192.168.23.34:9999/commands/np_list_number

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_list_number.xsd">
  <request domain="biysk.local"/>
</in>
CODE

Ответ:

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_list_number.xsd">
    <response>
        <np_list>
            <np name="city">
                <np_number name="240318"/>
                <np_number name="240500"/>
            </np>
            <np name="np_240">
                <np_number name="333333"/>
                <np_number name="415800"/>
            </np>
        </np_list>
    </response>
</out>
CODE

Hc_np_bind_number

Команда привязки номера плана нумерации с локальным номером или исходящем бриджем.

Аналог команды в CoCon:

domain/<DOMAIN>/np/numbers/bind

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/np_bind_number

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- <error> -->
  <xs:complexType name="npErrorType">
    <xs:attribute name="cmd" type="xs:token" use="required" />
    <xs:attribute name="reason" type="xs:string" use="required" />
    <xs:attribute name="body" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
    <xs:attribute name="entity" type="xs:normalizedString" use="optional" />
  </xs:complexType>
  <!-- </error> -->

  <!--Алиасы: -->
  <!-- alias_not_exists - нет такого алиаса-->
  <!-- np_number_not_exists - нет такого номера в плане нумерации-->
  <!-- np_not_exists - нет такого плана нумерации-->
  <!-- unsupported_np_type - с данным номером связан бридж-->
  <!-- np_number_already_binded - данный алиас уже привязан к этому номеру в плане нумерации-->
  <!-- np_already_binded - данный алиас уже привязан к другому номеру в плане нумерации-->
  <!--Бриджи: -->
  <!-- np_number_not_exists - нет такого номера в плане нумерации-->
  <!-- np_is_busy - к данному плану нумерации уже привязан бридж или алиасы-->
  <!-- np_a_not_exists - план нумерации А не существует-->
  <!-- np_b_not_exists - план нумерации Б не существует-->
  <!-- bridge_not_found - нет такого бриджа-->
  <!-- invalid_bridge - указанный бридж настроен неправильно для использования в данном плане нумерации-->

  <xs:simpleType name="npNumberResultType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ok" />
      <xs:enumeration value="alias_not_exists" />
      <xs:enumeration value="np_number_not_exists" />
      <xs:enumeration value="np_not_exists" />
      <xs:enumeration value="unsupported_np_type" />
      <xs:enumeration value="np_number_already_binded" />
      <xs:enumeration value="np_already_binded" />
      <xs:enumeration value="np_is_busy" />
      <xs:enumeration value="np_a_not_exists" />
      <xs:enumeration value="np_b_not_exists" />
      <xs:enumeration value="bridge_not_found" />
      <xs:enumeration value="invalid_bridge" />
      <xs:enumeration value="unknown_error" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="npNumberingPlan">
    <xs:sequence>
      <xs:element name="np_number" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:choice>
            <xs:element name="alias">
              <xs:complexType>
                <xs:attribute name="iface" type="xs:string" use="required"/>
                <xs:attribute name="name" type="xs:string" use="required"/>
                <xs:attribute name="mode" use="required">
                  <xs:simpleType>
                    <xs:restriction base="xs:token">
                      <xs:enumeration value="master"/>
                      <xs:enumeration value="passive"/>
                    </xs:restriction>
                  </xs:simpleType>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="bridge">
              <xs:complexType>
                <xs:attribute name="name" type="xs:string" use="required"/>
              </xs:complexType>
            </xs:element>
          </xs:choice>
          <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use = "required"/>
  </xs:complexType>

  <xs:complexType name="npList">
    <xs:sequence>
      <xs:element name="np" type="npNumberingPlan" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="npResult">
    <xs:sequence>
      <xs:element name="np_number" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="entity" type="xs:string"/>
          <xs:attribute name="result" type="npNumberResultType"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="npResultList">
    <xs:sequence>
      <xs:element name="np" type="npResult" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
        <xs:element name="request">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_list" type="npList"/>
            </xs:sequence>
            <xs:attribute name="domain" type="xs:string"/>
          </xs:complexType>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>
  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:choice>
        <!--Positive case-->
        <xs:element name="response">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="np_list" type="npResultList"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="npErrorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

CODE

Пример:

Запрос: http://192.168.1.21:9999/commands/np_bind_number

<?xml version="1.0"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_bind_number.xsd">
    <request domain="biysk.local">
        <np_list>
            <np name="np_240">
                <np_number name="700">
                    <alias iface="061dd777ba450f12" name="240466" mode="master"/>
                </np_number>
                <np_number name="700">
                    <alias iface="061dd777c14e201d" name="240467" mode="passive"/>
                </np_number>
                <np_number name="800">
                    <bridge name="biysk.local_to_biysk.test"/>
                </np_number>
            </np>
        </np_list>
    </request>
</in>
CODE

Ответ: 200

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_bind_number.xsd">
    <response>
        <np_list>
            <np name="np_240">
                <np_number name="700" entity="240466" result="ok"/>
                <np_number name="700" entity="240467" result="ok"/>
                <np_number name="800" entity="biysk.local_to_biysk.test" result="ok"/>
            </np>
        </np_list>
    </response>
</out>
CODE

Hc_np_unbind_number

Команда отменяет привязку номера/номеров плана нумерации с локальным номером или исходящем бриджем.

Аналог команды в CoCon:

domain/<DOMAIN>/np/numbers/unbind

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/np_unbind_number

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- <error> -->
    <xs:complexType name="npErrorType">
        <xs:attribute name="cmd" type="xs:token" use="required" />
        <xs:attribute name="reason" type="xs:string" use="required" />
        <xs:attribute name="body" type="xs:string" use="optional" />
        <!-- entity="[nonempty_string()]" -->
        <xs:attribute name="entity" type="xs:normalizedString" use="optional" />
    </xs:complexType>
    <!-- </error> -->
    <!--Алиасы: -->
    <!-- np_not_exists - нет такого плана нумерации -->
    <!-- np_number_not_binded - нет такого номера в плане нумерации, либо он не привязан к внутреннему номеру -->
    <!--Бриджи: -->
    <!-- bridge_not_found - нет такого бриджа -->
    <!-- np_a_not_exists - нет такого плана нумерации -->
    <!-- np_not_busy - номер не привязан к бриджу -->
    <!-- np_number_not_exists - нет такого номера в плане нумерации -->
    <!-- invalid_bridge - внутренняя ошибка бриджа -->
    <xs:simpleType name="npNumberResultType">
        <xs:restriction base="xs:token">
            <xs:enumeration value="ok" />
            <xs:enumeration value="np_not_exists" />
            <xs:enumeration value="np_number_not_binded" />
            <xs:enumeration value="bridge_not_found" />
            <xs:enumeration value="np_a_not_exists" />
            <xs:enumeration value="np_not_busy" />
            <xs:enumeration value="np_number_not_exists" />
            <xs:enumeration value="invalid_bridge" />
            <xs:enumeration value="unknown_error" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="npNumberingPlan">
        <xs:sequence>
            <xs:element name="np_number" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:choice>
                        <!-- Выполнить unbind для алиаса -->
                        <xs:element name="alias">
                            <xs:complexType>
                                <xs:attribute name="iface" type="xs:string" use="required"/>
                                <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:complexType>
                        </xs:element>
                        <!-- Выполнить unbind для бриджа -->
                        <xs:element name="bridge">
                            <xs:complexType>
                                <!-- Если имя бриджа неизвестно, можно указать в качестве имени бриджа any -->
                                <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:complexType>
                        </xs:element>
                        <!-- Выполнить unbind автоматически в зависимости от того к чему привязан номер плана нумерации -->
                        <xs:element name="clean"/>
                    </xs:choice>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use = "required"/>
    </xs:complexType>
    <xs:complexType name="npList">
        <xs:sequence>
            <xs:element name="np" type="npNumberingPlan" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="npResult">
        <xs:sequence>
            <xs:element name="np_number" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string"/>
                    <xs:attribute name="result" type="npNumberResultType"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string"/>
    </xs:complexType>
    <xs:complexType name="npResultList">
        <xs:sequence>
            <xs:element name="np" type="npResult" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="np_list" type="npList"/>
                        </xs:sequence>
                        <xs:attribute name="domain" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out-->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <!--Positive case-->
                <xs:element name="response">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="np_list" type="npResultList"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <!--Or error-->
                <xs:element name="error" type="npErrorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>

CODE

Пример:

Запрос: http://192.168.1.21:9999/commands/np_unbind_number

<?xml version="1.0"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_unbind_number.xsd">
    <request domain="biysk.local">
        <np_list>
            <np name="np_240">
                <np_number name="700">
                    <alias iface="061dd777ba450f12" name="240466"/>
                </np_number>
            </np>
        </np_list>
    </request>
</in>
CODE

Ответ:200

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_np_unbind_number.xsd">
    <response>
        <np_list>
            <np name="np_240">
                <np_number name="700" result="ok"/>
            </np>
        </np_list>
    </response>
</out>
CODE