Hc_sip_trunk - Управление SIP-транками (HTTP-терминал)
Hc_sip_trunk_declare
Команда позволяет создать SIP-транк.
Аналог команды в CoCon:
domain/<DOMAIN>/trunk/sip/declare
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_trunk_declare
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 201 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="valueType">
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<!-- nonEmptyString -->
<xs:simpleType name="nonEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name = "modeType">
<xs:restriction base="xs:string">
<xs:enumeration value="sip-proxy" />
<xs:enumeration value="sip-t" />
<xs:enumeration value="sip-i" />
<xs:enumeration value="sip-q" />
</xs:restriction>
</xs:simpleType>
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="domain" type="nonEmptyString" use="required" />
<xs:attribute name="context" type="xs:string" use="required" />
<xs:attribute name="modificator" type="nonEmptyString" use="optional" />
<xs:attribute name="group" type="nonEmptyString" use="required" />
<xs:attribute name="iface" type="nonEmptyString" use="required" />
<xs:attribute name="ip" type="xs:string" use="optional" />
<xs:attribute name="ip_set" type="xs:string" use="required" />
<xs:attribute name="port" type="xs:integer" use="optional" />
<xs:attribute name="listen_port" type="xs:string" use="optional" />
<xs:attribute name="mode" type="modeType" use="optional" />
<xs:attribute name="registration" type="xs:boolean" use="optional" />
<xs:attribute name="force" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="progress">
<xs:complexType>
<xs:all>
<xs:element name="text" minOccurs="1" type="valueType" />
<xs:element name="ref" minOccurs="1" type="valueType" />
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Запрос: http://192.168.1.21:9999/commands/sip_trunk_declare
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_declare.xsd">
<sip domain="biysk.local" force="true" listen_port="5075" port="5075" iface="ems5" ip_set="ipset1" mode="sip-proxy" context="ctx_from_local" group="ssw.gr" ip="192.168.2.15"/>
</in>
Ответ: 201
Hc_sip_trunk_set
Команда позволяет установить или изменить параметры SIP-транка.
Аналог команды в CoCon:
domain/<DOMAIN>/trunk/sip/set
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_trunk_set
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями::
- 100 - в случае прогресса;
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- valueType -->
<xs:complexType name="valueType">
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<!-- okType-->
<xs:complexType name="okType">
<xs:attribute name="property" type="xs:string" use="required"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
</xs:complexType>
<!-- propertyKeyType -->
<xs:simpleType name="propertyKeyType">
<xs:restriction base="xs:string">
<xs:enumeration value="block"/>
<xs:enumeration value="alarm_enable"/>
<xs:enumeration value="call_limit"/>
<xs:enumeration value="reg_expire_min"/>
<xs:enumeration value="reg_expire_max"/>
<xs:enumeration value="content_encoding">
<xs:annotation>
<xs:documentation>
Values: gzip|none
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="ip_set"/>
<xs:enumeration value="ip"/>
<xs:enumeration value="isup_r_ccl_send"/>
<xs:enumeration value="listen_port"/>
<xs:enumeration value="cause_location"/>
<xs:enumeration value="maddr"/>
<xs:enumeration value="mode">
<xs:annotation>
<xs:documentation>
Values: sip-t|sip-i|sip-q|sip-proxy
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="my_from"/>
<xs:enumeration value="options_control"/>
<xs:enumeration value="port"/>
<xs:enumeration value="host"/>
<xs:enumeration value="disable_remote_control"/>
<xs:enumeration value="inc_authentication"/>
<xs:enumeration value="inc_authentication_type">
<xs:annotation>
<xs:documentation>
Values: proxy|user
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="inc_login"/>
<xs:enumeration value="inc_password"/>
<xs:enumeration value="out_login"/>
<xs:enumeration value="out_password"/>
<xs:enumeration value="rel_to_cancel"/>
<xs:enumeration value="req100rel"/>
<xs:enumeration value="rfc4028_control"/>
<xs:enumeration value="context"/>
<xs:enumeration value="modificator"/>
<xs:enumeration value="sip_transport">
<xs:annotation>
<xs:documentation>
Values: tcp_only|udp_only|tcp_prefer|udp_prefer
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="sipdomain"/>
<xs:enumeration value="symbol_hash_as_is"/>
<xs:enumeration value="trunk"/>
<xs:enumeration value="remote_network_type">
<xs:annotation>
<xs:documentation>
Values: private|local|transit|international
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="allow_user_registration"/>
<xs:enumeration value="dtmf_relay"/>
<xs:enumeration value="dtmf_duration"/>
<xs:enumeration value="referred_by_as_cgpn"/>
<xs:enumeration value="route_by_via"/>
<xs:enumeration value="nat_traversal"/>
<xs:enumeration value="tel_uri_using"/>
<xs:enumeration value="user_name"/>
<xs:enumeration value="out_registration"/>
<xs:enumeration value="area"/>
<xs:enumeration value="compact_form"/>
<xs:enumeration value="transit"/>
<xs:enumeration value="isup_standard">
<xs:annotation>
<xs:documentation>
Values: etsi|rus|ansi|telcordia
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="display_encoding">
<xs:annotation>
<xs:documentation>
Values: default|win1251
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="category_to_sip"/>
<xs:enumeration value="invite_transaction_timeout"/>
</xs:restriction>
</xs:simpleType>
<!-- propertyType -->
<xs:complexType name="propertyType">
<xs:attribute name="name" type="propertyKeyType" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<!-- sipType -->
<xs:complexType name="sipType">
<xs:all>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="group" type="xs:string" use="required"/>
<xs:attribute name="iface" type="xs:string" use="optional"/>
<xs:attribute name="force" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" type="sipType" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out-->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response">
<xs:complexType>
<xs:sequence>
<!-- ok -->
<xs:element name="ok" type="okType" minOccurs="0" maxOccurs="unbounded"/>
<!-- error -->
<xs:element name="error" type="okType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<!-- progress -->
<xs:element name="progress">
<xs:complexType>
<xs:all>
<xs:element name="text" type="valueType"/>
<xs:element name="ref" type="valueType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/sip_trunk_set
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_trunk_set.xsd">
<sip group="ssw.gr" iface="ems5" domain="biysk.local">
<properties>
<property name="alarm_enable" value="true"/>
<property name="options_control" value="60"/>
<property name="mode" value="sip-t"/>
</properties>
</sip>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_set.xsd">
<response>
<ok property="alarm_enable"/>
<ok property="options_control"/>
<ok property="mode"/>
</response>
</out>
Может вернуть прогресс:
<?xml version="1.0"?>
<progress xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_set.xsd">
<ref value="{md@sky,{1314,939007,922379}}"/>
<state value="set_result"/>
<ip value="127.0.0.1"/>
<port value="1234"/>
</progress>
Hc_sip_trunk_show
Команда для просмотра настроек SIP-транка.
Аналог команды в CoCon:
domain/<DOMAIN>/trunk/sip/info
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_trunk_show
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить двумя сообщениями:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- rfc4028ControlType -->
<xs:simpleType name="rfc4028ControlType">
<xs:restriction base="xs:string">
<xs:enumeration value="true" />
<xs:enumeration value="false" />
<xs:enumeration value="force" />
</xs:restriction>
</xs:simpleType>
<!-- displayEncodingType -->
<xs:simpleType name="displayEncodingType">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="win1251"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="groupType">
<xs:attribute name="group" type="xs:string" use="required" />
<xs:attribute name="call_count" type="xs:integer" use="required" />
<xs:attribute name="my_from" type="xs:string" use="optional" />
<xs:attribute name="context" type="xs:string" use="optional" />
<xs:attribute name="modificator" type="xs:string" use="optional" />
</xs:complexType>
<xs:complexType name="iface_shortType">
<xs:attribute name="uri" type="xs:string" use="required" />
<xs:attribute name="group" type="xs:string" use="required" />
<xs:attribute name="isActive" type="xs:boolean" use="required" />
<xs:attribute name="mode" type="xs:string" use="required" />
<xs:attribute name="dynamic" type="xs:string" use="required" />
<xs:attribute name="block" type="xs:boolean" use="required" />
<xs:attribute name="host" type="xs:string" use="optional" />
<xs:attribute name="port" type="xs:integer" use="optional" />
<xs:attribute name="ip_set" type="xs:string" use="optional" />
<xs:attribute name="listen_port" type="xs:string" use="optional" />
<xs:attribute name="context" type="xs:string" use="optional" />
<xs:attribute name="modificator" type="xs:string" use="optional" />
</xs:complexType>
<xs:complexType name="ifaceType">
<xs:attribute name="uri" type="xs:string" use="required" />
<xs:attribute name="group" type="xs:string" use="required" />
<xs:attribute name="isActive" type="xs:boolean" use="required" />
<xs:attribute name="mode" type="xs:string" use="required" />
<xs:attribute name="dynamic" type="xs:string" use="required" />
<xs:attribute name="block" type="xs:boolean" use="required" />
<!-- optional -->
<xs:attribute name="my_from" type="xs:string" use="optional" />
<xs:attribute name="context" type="xs:string" use="optional" />
<xs:attribute name="modificator" type="xs:string" use="optional" />
<xs:attribute name="alarm_enable" type="xs:boolean" use="optional" />
<xs:attribute name="host" type="xs:string" use="optional" />
<xs:attribute name="port" type="xs:integer" use="optional" />
<xs:attribute name="ip_set" type="xs:string" use="optional" />
<xs:attribute name="listen_port" type="xs:string" use="optional" />
<xs:attribute name="auth_type" type="xs:string" use="optional" />
<xs:attribute name="rel_to_cancel" type="xs:boolean" use="optional" />
<xs:attribute name="isup_r_ccl_send" type="xs:boolean" use="optional" />
<xs:attribute name="req100rel" type="xs:boolean" use="optional" />
<xs:attribute name="symbol_hash_as_is" type="xs:boolean" use="optional" />
<xs:attribute name="disable_remote_control" type="xs:boolean" use="optional" />
<xs:attribute name="inc_authentication" type="xs:boolean" use="optional" />
<xs:attribute name="rfc4028_control" type="rfc4028ControlType" use="optional" />
<xs:attribute name="cause_location" type="xs:string" use="optional" />
<xs:attribute name="inc_authentication_type" type="xs:string" use="optional" />
<xs:attribute name="content_encoding" type="xs:string" use="optional" />
<xs:attribute name="sip_transport" type="xs:string" use="optional" />
<xs:attribute name="sip_i_support" type="xs:boolean" use="optional" />
<xs:attribute name="options_control" type="xs:integer" use="optional" />
<xs:attribute name="call_count" type="xs:integer" use="optional" />
<xs:attribute name="reg_expire_min" type="xs:integer" use="optional" />
<xs:attribute name="reg_expire_max" type="xs:integer" use="optional" />
<xs:attribute name="trunk" type="xs:string" use="optional" />
<xs:attribute name="inc_login" type="xs:string" use="optional" />
<xs:attribute name="inc_password" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">
In case of strong security restrictions password may be shown as ********
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="out_login" type="xs:string" use="optional" />
<xs:attribute name="out_password" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">
In case of strong security restrictions password may be shown as ********
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maddr" type="xs:string" use="optional" />
<xs:attribute name="sipdomain" type="xs:string" use="optional" />
<xs:attribute name="iface" type="xs:string" use="optional" />
<xs:attribute name="display_encoding" type="displayEncodingType" use="optional"/>
<xs:attribute name="category_to_sip" type="xs:string" use="optional"/>
<xs:attribute name="invite_transaction_timeout" type="xs:integer" use="optional"/>
</xs:complexType>
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="domain" type="xs:string" use="required" />
<xs:attribute name="group" type="xs:string" use="required" />
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="out">
<xs:complexType>
<xs:choice minOccurs="0">
<xs:element name="group_info" type="groupType" maxOccurs="unbounded"/>
<xs:element name="iface_info" type="ifaceType" maxOccurs="unbounded"/>
<xs:element name="iface_short_info" type="iface_shortType" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Запрос: http://192.168.1.21:9999/commands/sip_trunk_show
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_show.xsd">
<sip domain="biysk.local" group="ssw.gr" id="ems2" />
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_show.xsd">
<iface_info invite_transaction_timeout="32000" display_encoding="default" context="ctx_from_local" group="ssw.gr" rfc4028_control="force" disable_remote_control="false" symbol_hash_as_is="false" trunk="biysk.local.ssw.gr.trunk.autoname" alarm_enable="false" my_from="biysk.local" category_to_sip="default" sip_transport="udp_only" cause_location="default" rel_to_cancel="false" maddr="none" content_encoding="none" out_password="********" out_login="none" inc_password="********" inc_login="none" inc_authentication_type="user" inc_authentication="true" options_control="0" block="false" listen_port="5072" ip_set="ipset1" port="5072" host="192.168.2.12" mode="sip-proxy" dynamic="false" sipdomain="use-address" req100rel="false" uri="ems2" isActive="true"/>
</out>
Hc_sip_trunk_remove
Команда позволяет удалить SIP-транк.
Аналог команды в CoCon:
domain/<DOMAIN>/trunk/sip/remove
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_trunk_remove
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 204 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="domain" type="xs:string" use="required" />
<xs:attribute name="group" type="xs:string" use="required" />
<xs:attribute name="force" type="xs:boolean" use="optional" />
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/sip_trunk_remove
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_remove.xsd">
<sip domain="biysk.local" group="ssw.gr" id="ems5" />
</in>
Ответ с требованием подтверждения:
status: 300
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="modal.xsd">
<modal ref="md1@ecss1:1475" from="remove" passwd="false" results="yesno">
<header template="Remove interfaces. Undo will be impossible"/>
<prompt template="continue"/>
<error template="You should enter 'yes' or 'no'"/>
</modal>
</out>
Запрос безусловного удаления:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_remove.xsd">
<sip domain="biysk.local" group="ssw.gr" id="ems5" force="true" />
</in>
Ответ: 204
Hc_sip_trunk_check
Команда для проверки доступности SIP-транка.
Аналог команды в CoCon:
domain/<DOMAIN>/trunk/sip/check
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_trunk_check
Код HTTP-ответа::
- 204 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- trunkType -->
<xs:complexType name="trunkType">
<xs:attribute name="accessible" type="xs:boolean" use="required"/>
<xs:attribute name="iface" type="xs:string" use="required"/>
<xs:attribute name="info" type="xs:string" use="required"/>
</xs:complexType>
<!-- trunksType -->
<xs:complexType name="trunksType">
<xs:sequence>
<xs:element name="trunk" type="trunkType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- requestType -->
<xs:complexType name="requestType">
<xs:sequence>
<xs:element name="trunk" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="group" type="xs:string" use="required"/>
<xs:attribute name="iface" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="domain" type="xs:string" use="required"/>
</xs:complexType>
<!-- responseType -->
<xs:complexType name="responseType">
<xs:all>
<xs:element name="trunks" type="trunksType" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" type="requestType" minOccurs="1" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response" type="responseType" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/sip_trunk_check
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_check.xsd">
<request domain="biysk.local">
<trunk group="smg.gr" iface="smg-4" />
<trunk group="sbc.gr" iface="to_aster" />
<trunk group="ssw.gr" iface="ems1" />
</request>
</in>
Ответ: 200
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_trunk_check.xsd">
<response>
<trunks>
<trunk iface="smg-4" accessible="true" info="OPTIONS to <sip:192.168.2.8>: 200 OK, cseq: 83004 OPTIONS. Request by node: sip1@ecss1"/>
<trunk iface="to_aster" accessible="false" info="Response timeout is expired. Request by node: sip1@ecss1"/>
<trunk iface="ems1" accessible="false" info="Response timeout is expired. Request by node: sip1@ecss1"/>
</trunks>
</response>
</out>