Hc_direction_list

Команда позволяет получить список направлений.

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

domain/<DOMAIN>/direction/list

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

POST

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

http://host:port/commands/direction_list

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

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

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

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

  <xs:complexType name="domainType">
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="directionType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="is_active" type="xs:boolean" use="optional"/>
    <xs:attribute name="description" type="xs:string" use="optional"/>
    <xs:attribute name="bandwidth" type="xs:integer" use="optional"/>
    <xs:attribute name="trunks" type="xs:string" use="optional"/>
  </xs:complexType>

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

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </xs:complexType>
	</xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:all>
	<xs:element name="response">

	  <xs:complexType>
	    <xs:all>
	      <xs:element name="domain" type="domainOutType"/>
	    </xs:all>
	  </xs:complexType>


	</xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

</xs:schema>
CODE

Пример:

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

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

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_list.xsd">
    <response>
        <domain name="biysk.local">
            <direction description="ems_trunks" name="ems1" trunks="ems1;ems2" bandwidth="20" is_active="true"/>
            <direction description="test description" name="dir2" trunks="" bandwidth="10" is_active="true"/>
            <direction description="to 192.68.2.12" name="bsk" trunks="bsk1;bsk2" bandwidth="50" is_active="false"/>
        </domain>
    </response>
</out>
CODE

Hc_direction_declare

Команда позволяет создать новое направление.

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

domain/<DOMAIN>/direction/

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

POST

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

http://host:port/commands/direction_declare

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

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

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

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

  <xs:complexType name="directionType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="is_active" type="xs:boolean" use="optional"/>
    <xs:attribute name="description" type="xs:string" use="optional"/>
    <xs:attribute name="bandwidth" type="xs:integer" use="optional"/>
  </xs:complexType>

  <xs:complexType name="domainType">
    <xs:sequence>
      <xs:element name="direction" type="directionType" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:sequence>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </xs:complexType>
	</xs:element>
      </xs:sequence>
    </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="ok"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="errorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
CODE

Пример:

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

<?xml version="1.0" encoding="UTF-8"?>
<in
	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_declare.xsd">
	<request>
		<domain name="biysk.local">
			<direction name="dir2" description="test description" is_active="true" bandwidth="10"/>
		</domain>
	</request>
</in>
CODE

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_declare.xsd">
  <response>
    <ok/>
  </response>
</out>
CODE

Код ответа:

404

Ответ:

<?xml version="1.0" encoding="UTF-8"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_declare.xsd">
  <error cmd="hc_direction_declare" reason="already_declared" body="{error,already_declared}"/>
</out>
CODE

Hc_direction_remove

Команда позволяет удалить имеющееся направление.

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

domain/<DOMAIN>/direction/remove

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

POST

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

http://host:port/commands/direction_remove

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

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

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

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

  <xs:complexType name="domainType">
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	      <xs:element name="direction" type="domainType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </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="ok"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="errorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
CODE

Пример:

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

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

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_remove.xsd">
  <response>
    <ok/>
  </response>
</out>
CODE

Код ответа:

404

Ответ:

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_remove.xsd">
    <error cmd="hc_direction_remove" reason="not_exists" body="{error,direction_not_exists}" entity="biysk.local"/>
</out>
CODE

Hc_direction_set

Команда позволяет изменить значение свойств направления.

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

domain/<DOMAIN>/direction/set

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

POST

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

http://host:port/commands/direction_set

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

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

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

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

  <xs:complexType name="propertyType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="trunksType">
    <xs:attribute name="owner" type="xs:string" use="required"/>
    <xs:attribute name="group" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="directionType">
    <xs:choice>
      <xs:element name="trunks" type="trunksType"/>
      <xs:element name="property" type="propertyType"/>
    </xs:choice>
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

<!--
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="is_active" type="xs:boolean" use="optional"/>
    <xs:attribute name="description" type="xs:string" use="optional"/>
    <xs:attribute name="bandwidth" type="xs:integer" use="optional"/>
-->

  <xs:complexType name="domainType">
    <xs:sequence>
      <xs:element name="direction" type="directionType" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:sequence>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </xs:complexType>
	</xs:element>
      </xs:sequence>
    </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="ok"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="errorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
CODE

Пример:

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

<?xml version="1.0" encoding="UTF-8"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_set.xsd">
    <request>
        <domain name="biysk.local">
            <direction name="bsk">
                <trunks owner="*" group="ssw.gr" value="bsk1;bsk2;ems1;ems2"/>
            </direction>
        </domain>
    </request>
</in>
CODE

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_set.xsd">
    <response>
        <ok/>
    </response>
</out>
CODE
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_set.xsd">
<request>
  <domain name="biysk.local">
   <direction name="bsk">
    <property name="is_active" value="false"/>
   </direction>
  </domain>
</request>
</in>
CODE

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_set.xsd">
    <response>
        <ok/>
    </response>
</out>
CODE

Код ответа:

404

Ответ:

<?xml version="1.0" encoding="UTF-8"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_set.xsd">
  <error cmd="hc_direction_set" reason="badargs" body="{error,unknown_property}"/></out>",
</out>
CODE

Hc_direction_info

Команда позволяет просмотреть список свойств направления.

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

domain/<DOMAIN>/direction/info

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

POST

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

http://host:port/commands/direction_info

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

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

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

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

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

  <xs:complexType name="directionType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="is_active" type="xs:boolean" use="optional"/>
    <xs:attribute name="description" type="xs:string" use="optional"/>
    <xs:attribute name="bandwidth" type="xs:integer" use="optional"/>
    <xs:attribute name="trunks" type="xs:string" use="optional"/>
  </xs:complexType>

  <xs:complexType name="directionOutType">
    <xs:sequence>
      <xs:element name="trunks" type="trunksType" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="is_active" type="xs:boolean" use="optional"/>
    <xs:attribute name="description" type="xs:string" use="optional"/>
    <xs:attribute name="bandwidth" type="xs:integer" use="optional"/>
  </xs:complexType>

  <xs:complexType name="domainOutType">
    <xs:sequence>
      <xs:element name="direction" type="directionOutType" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="trunksType">
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>


  <!-- in -->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	      <xs:element name="direction" type="domainType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </xs:complexType>
	</xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

  <!-- out -->
  <xs:element name="out">
    <xs:complexType>
      <xs:all>
	<xs:element name="response">
	  <xs:complexType>
	    <xs:all>
	      <xs:element name="domain" type="domainOutType"/>
	    </xs:all>
	  </xs:complexType>
	</xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>
</xs:schema>
CODE

Пример:

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

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

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_info.xsd">
    <response>
        <domain name="biysk.local">
            <direction description="to 192.68.2.12" name="bsk" bandwidth="50" is_active="false">
                <trunks value="bsk1;bsk2"/>
            </direction>
        </domain>
    </response>
</out>
CODE

Hc_direction_reset_stat

Команда позволяет сбросить статистику по направлению.

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

domain/<DOMAIN>/direction/reset-statistics

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

POST

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

http://host:port/commands/direction_reset_stat

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

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

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

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

  <xs:complexType name="domainType">
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>


<xs:complexType name="optionType">
  <xs:attribute name="name" type="optionProp" use="required"/>
</xs:complexType>

<xs:simpleType name="optionProp">
  <xs:restriction base="xs:token">
    <xs:enumeration value="description"/>
    <xs:enumeration value="trunks"/>
    <xs:enumeration value="is_active"/>
    <xs:enumeration value="bandwidth"/>
  </xs:restriction>
</xs:simpleType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	      <xs:element name="direction" type="domainType" minOccurs="1" maxOccurs="1"/>
	      <xs:element name="option" type="optionType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </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="ok"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="errorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
CODE

Пример:

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

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

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_reset_stat.xsd">
  <response>
    <ok/>
  </response>
</out>
CODE

Код ответа:

404

Ответ:

<?xml version="1.0" encoding="UTF-8"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_reset_stat.xsd">
  <error cmd="hc_direction_reset_stat" reason="not_exists" body="{error,direction_not_exists}" entity="d.city"/>
</out>
CODE

Hc_direction_clean

Команда позволяет удалить определенное свойство из направления.

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

domain/<DOMAIN>/direction/clean

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

POST

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

http://host:port/commands/direction_clean

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

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

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

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

  <xs:complexType name="domainType">
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>


<xs:complexType name="optionType">
  <xs:attribute name="name" type="optionProp" use="required"/>
</xs:complexType>

<xs:simpleType name="optionProp">
  <xs:restriction base="xs:token">
    <xs:enumeration value="description"/>
    <xs:enumeration value="trunks"/>
    <xs:enumeration value="is_active"/>
    <xs:enumeration value="bandwidth"/>
  </xs:restriction>
</xs:simpleType>

  <!-- in-->
  <xs:element name="in">
    <xs:complexType>
      <xs:all>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	      <xs:element name="direction" type="domainType" minOccurs="1" maxOccurs="1"/>
	      <xs:element name="option" type="optionType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </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="ok"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="errorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
CODE

Пример:

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

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

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_clean.xsd">
  <response>
    <ok/>
  </response>
</out>
CODE

При несуществующем направлении

Код ответа:
200

Ответ:

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_direction_clean.xsd">
    <error cmd="hc_direction_clean" reason="not_exists" body="{error,direction_not_exists}" entity="biysk.local"/>
</out>
CODE