Hc_alias_list
Команда возвращает список алиасов, определенных в домене и определенных в домене для определенного адреса или диапазона адресов.
Аналог команды в CoCon:domain/<DOMAIN>/alias/where
domain/<DOMAIN>/alias/list
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_list
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с запросом/ответом:
hc_alias_list.xsd:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="aliases_list.xsd"/> <!-- in--> <xs:element name="in"> <xs:complexType> <xs:all> <xs:element name="aliases" minOccurs="1"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="addr" type="xs:string" use="optional"/> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> <!-- out --> <xs:element name="out"> <xs:complexType> <xs:all> <xs:element name="aliases" minOccurs="1"> <xs:complexType> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> </xs:schema>
aliases_list.xsd:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- aliasType--> <xs:complexType name="aliasType"> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="interface" type="xs:string" use="required"/> <xs:attribute name="interface_type" type="xs:string" use="optional"/> <xs:attribute name="interface_group" type="xs:string" use="optional"/> <xs:attribute name="address" type="xs:string" use="required"/> <xs:attribute name="iface_name" type="xs:string" use="optional"/> <xs:attribute name="active" type="xs:boolean" use="required"/> <xs:attribute name="binded" type="xs:boolean" use="optional"/> <xs:attribute name="displayName" type="xs:string" use="optional"/> </xs:complexType> <!-- errorType--> <xs:complexType name="errorType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="interface" type="xs:string"/> <xs:attribute name="address" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/alias_list
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_alias_list.xsd"> <aliases domain="biysk.local" addr="24046{2-4}" /> </in>
Ответ:
<?xml version="1.0" encoding="UTF-8"?> <out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_alias_list.xsd"> <aliases> <alias domain="biysk.local" interface="e389d17f989f2047" interface_type="sip" interface_group="loc.gr" address="240462" active="true" /> <alias domain="biysk.local" interface="e389d19152a30983" interface_type="sip" interface_group="loc.gr" address="240464" active="true" /> </aliases> </out>
Hc_ alias_where
Команда возвращает список задекларированных алиасов с определенным адресом (во всех доменах, со всеми интерфейсами).
Аналог команды в CoCon:
domain/<DOMAIN>/alias/where
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_where
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с ответом:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="aliases_list.xsd"/> <!-- in--> <xs:element name="in"> <xs:complexType> <xs:all> <xs:element name="aliases" minOccurs="1"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="addr" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> <!-- out --> <xs:element name="out"> <xs:complexType> <xs:all> <xs:element name="aliases" minOccurs="1"> <xs:complexType> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> </xs:schema>
aliases_list.xsd:
Схема файла определена в разделе hc_aliases_list.
Пример:
Запрос: http://192.168.1.21:9999/commands/alias_where
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_alias_where.xsd"> <aliases addr="2403{28-31}" domain="biysk.local" /> </in>
Ответ:
<?xml version="1.0" encoding="UTF-8"?> <out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_alias_where.xsd"> <aliases> <alias domain="biysk.local" interface="e389d1f24013cdf9" address="240328" iface_name="240328@biysk.local" active="true" binded="true" displayName="" /> <alias domain="biysk.local" interface="e389d1f2402f786b" address="240329" iface_name="240329@biysk.local" active="true" binded="true" displayName="" /> <error address="240330">{not_exists,"240330"}</error> <alias domain="biysk.local" interface="virtual:240331@biysk.local" address="240331" iface_name="virtual:240331@biysk.local" active="true" binded="true" displayName="" /> </aliases> </out>
Hc_alias_who
Команда возвращает список задекларированных алиасов с определенным интерфейсом (во всех доменах, со всеми адресами).
Аналог команды в CoCon:
domain/<DOMAIN>/alias/who
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_who
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с запросом/ответом:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="aliases_list.xsd"/> <!-- in--> <xs:element name="in"> <xs:complexType> <xs:all> <xs:element name="aliases" minOccurs="1"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="iface" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> <!-- out --> <xs:element name="out"> <xs:complexType> <xs:all> <xs:element name="aliases" minOccurs="1"> <xs:complexType> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> </xs:schema>
aliases_list.xsd:
Схема файла определена в разделе hc_aliases_list.
Пример:
Запрос: http://192.168.1.21:9999/commands/alias_who
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_alias_who.xsd"> <aliases iface="e389d19152a30983" domain="biysk.local" /> </in>
Ответ:
<?xml version="1.0"?> <out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_alias_who.xsd"> <aliases> <alias domain="biysk.local" interface="e389d19152a30983" address="240464" active="true" binded="true" displayName=""/> </aliases> </out>
Hc_ alias_info
Команда возвращает информацию о свойствах алиасов. Кроме того предусмотрена фильтрация по доменам, адресам, интерфейсам и свойствам алиаса посредством POST-запроса.
Аналог команды в CoCon:
domain/<DOMAIN>/alias/info
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_info
- Для возврата свойства на уровне домена: указать domain
- Для возврата свойства на уровне адреса: указать addr
- Для возврата свойства на уровне домен+адрес: указать domain, addr
- Для возврата свойства на уровне домен+интерфейс: указать domain, iface
- Для возврата свойства на уровне домен+интерфейс+адрес: указать domain, iface, addr
- Для возврата свойства с именем propertyName уровня домен+интерфейс+адрес: указать domain, iface, addr, prop
Каждый из параметров «iface», «addr», «prop» может как присутствовать, так и отсутствовать. «propertyName» представляет собой имя свойства, значения которого необходимо получить. «iface_pattern» и «addr_pattern» представляют собой шаблон имени интерфейса и шаблон адреса соответственно. В шаблоне для отображения диапазона адресов/интерфейсов можно воспользоваться шаблоном “{from-to}”, где from и to – нижняя и верхняя граница перечисления адресов/интерфейсов. Например: шаблон для адреса ”550{02-10}01” выведет следующие адреса:
5500201, 5500301, 5500401, 5500501, 5500601, 5500701, 5500801, 5500901, 5501001 .
Для имен интерфейсов можно также воспользоваться данным шаблоном. Когда одновременно присутствуют параметры «iface» и «addr», каждый из них может принимать значение прочерк (_). Прочерк означает, что значение данного параметра вычисляется на основе второго.
В зависимости от того, какие параметры присутствуют в POST-запросе, возвращаются свойства, расположенные на разных уровнях.
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с запросом/ответом:
aliases.xsd
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- propertyTypeType--> <xs:simpleType name="propertyTypeType"> <xs:restriction base="xs:string"> <xs:enumeration value="global"/> <xs:enumeration value="domain"/> <xs:enumeration value="domain_interface"/> <xs:enumeration value="domain_address"/> <xs:enumeration value="address"/> <xs:enumeration value="profile"/> <xs:enumeration value="alias"/> </xs:restriction> </xs:simpleType> <!-- propertyType--> <xs:complexType name="propertyType"> <xs:attribute name="name" type="xs:string" use="required"/> <xs:attribute name="type" type="propertyTypeType" use="required"/> <xs:attribute name="value" type="xs:string" use="required"> <xs:annotation> <xs:documentation xml:lang="en"> For other type of properties value will be formatted specifically. Key: timetables\TIMETABLE_NAME Value: {"name":"TIMETABLE_NAME", "filters":[{"date":"DAYS_LIST_OR_DAY_TYPE_NAME","from":"FROM_HH:FROM_MM","to":"TO_HH:TO_MM"}],"properties":{"description | KEY":"VALUE"}} Sample: {"name":"tt2","filters":[{"date":"1 2 3 4 5","from":"9:0","to":"12:59"},{"date":"HOLIDAY","from":"13:0","to":"17:59"}],"properties":{"description":"Мой 2","key3":"{hello,world}"}} </xs:documentation> </xs:annotation> </xs:attribute> </xs:complexType> <!-- aliasType--> <xs:complexType name="aliasType"> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="iface" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> </xs:complexType> <!-- addressType--> <xs:complexType name="addressType"> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required"/> </xs:complexType> <!-- ifaceType--> <xs:complexType name="ifaceType"> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required"/> </xs:complexType> <!-- errorType--> <xs:complexType name="errorType"> <xs:attribute name="iface" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> <xs:attribute name="value" type="xs:string" use="required"/> </xs:complexType> <!-- Properties elements--> <xs:complexType name="ifacesType"> <xs:sequence> <xs:element name="iface" type="ifaceType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="domain" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="addressesType"> <xs:sequence> <xs:element name="address" type="addressType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="domain" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="aliasesType"> <xs:sequence> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="domain" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="domainType"> <xs:sequence> <xs:element name="property" type="propertyType" 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:sequence> <xs:element name="aliases" minOccurs="1" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="addr" type="xs:string" use="optional"/> <xs:attribute name="iface" type="xs:string" use="optional"/> <!-- iface задавать только как iface_id! --> <xs:attribute name="prop" type="xs:string" use="optional"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <!-- out--> <xs:element name="out"> <xs:complexType> <xs:choice> <xs:element name="domain" type="domainType"/> <xs:element name="ifaces" type="ifacesType"/> <xs:element name="addresses" type="addressesType"/> <xs:element name="aliases" type="aliasesType"/> </xs:choice> </xs:complexType> </xs:element> </xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/alias_info
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="aliases.xsd"> <aliases addr="2405{19-20}" domain="biysk.local" iface="_" /> </in>
Ответ:
<?xml version="1.0"?> <out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="aliases.xsd"> <aliases domain="biysk.local"> <alias iface="e389d228b8fd1fd7" address="240519"> <property name="timezone" type="global" value="UTC+07:00"/> <property name="terminal_type" type="alias" value="basic"/> <property name="subscriber_portal\password" type="alias" value=""9ahKLtIS""/> <property name="subscriber_portal\login" type="alias" value=""240519""/> <property name="ss\mgm\telephone" type="global" value="enabled"/> <property name="screening" type="profile" value="networkProvided"/> <property name="profile" type="alias" value="user_default"/> <property name="pin" type="global" value="1111"/> <property name="npi" type="profile" value="isdnTelephony"/> <property name="ni" type="profile" value="private"/> <property name="nai" type="profile" value="subscriberNumber"/> <property name="media-profile" type="domain" value="default"/> <property name="isIfaceActive" type="alias" value="true"/> <property name="isActive" type="alias" value="true"/> <property name="dtmf_source" type="alias" value="rfc+info"/> <property name="cdr_group" type="domain" value="bsk3"/> <property name="category" type="profile" value="10"/> <property name="access_type" type="domain" value="access_type0"/> <property name="access_group" type="profile" value="all"/> </alias> <alias iface="e389d228b91ff62e" address="240520"> <property name="timezone" type="global" value="UTC+07:00"/> <property name="terminal_type" type="alias" value="smart"/> <property name="subscriber_portal\password" type="alias" value=""9kQXBQC4""/> <property name="subscriber_portal\login" type="alias" value=""240520""/> <property name="ss\mgm\telephone" type="global" value="enabled"/> <property name="screening" type="profile" value="networkProvided"/> <property name="regime" type="domain_address" value="accsusp"/> <property name="profile" type="alias" value="user_default"/> <property name="pin\terminal_type\email" type="domain_address" value="[1234,smart,sss]"/> <property name="pin\terminal_type" type="domain_address" value="[1234,smart]"/> <property name="pin" type="global" value="1111"/> <property name="npi" type="profile" value="isdnTelephony"/> <property name="ni" type="profile" value="private"/> <property name="nai" type="profile" value="subscriberNumber"/> <property name="media-profile" type="domain" value="default"/> <property name="isIfaceActive" type="alias" value="false"/> <property name="isActive" type="alias" value="true"/> <property name="email" type="alias" value="agent20@bsk.loc"/> <property name="dtmf_source" type="alias" value="rfc+info"/> <property name="displayName" type="alias" value="agent_20"/> <property name="cdr_group" type="domain" value="bsk3"/> <property name="category" type="profile" value="10"/> <property name="access_type" type="domain" value="access_type0"/> <property name="access_group" type="profile" value="all"/> </alias> </aliases> </out>
Hc_alias_set
Команда предназначена для задания свойств алиаса на различных уровнях. Свойства могут быть определены на уровнях: глобальный, домен, адрес, домен + адрес, домен + интерфейс, домен + адрес + интерфейс.
Аналог команды в CoCon:
domain/<DOMAIN>/alias/set
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_set
Код HTTP-ответа:
- 201 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с запросом:
set_alias_properties.xsd
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- propertyType--> <xs:complexType name="propertyType"> <xs:attribute name="name" type="xs:string" use="required"/> <xs:attribute name="value" type="xs:string" use="required"> <xs:annotation> <xs:documentation xml:lang="en"> For other type of properties value will be formatted specifically. Key: timetables\TIMETABLE_NAME Value: {"name":"TIMETABLE_NAME", "filters":[{"date":"DAYS_LIST_OR_DAY_TYPE_NAME","from":"FROM_HH:FROM_MM","to":"TO_HH:TO_MM"}],"properties":{"description | KEY":"VALUE"}} Sample: {"name":"tt2","filters":[{"date":"1 2 3 4 5","from":"9:0","to":"12:59"},{"date":"HOLIDAY","from":"13:0","to":"17:59"}],"properties":{"description":"Мой 2","key3":"{hello,world}"}} </xs:documentation> </xs:annotation> </xs:attribute> </xs:complexType> <!-- in--> <xs:element name="in"> <xs:complexType> <xs:all> <xs:element name="aliases"> <xs:complexType> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="addr" type="xs:string" use="optional"/> <xs:attribute name="iface" type="xs:string" use="optional"/> <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:sequence> <xs:element name="error"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="optional" /> <xs:attribute name="iface" type="xs:string" use="optional" /> <xs:attribute name="addr" type="xs:string" use="optional" /> <xs:attribute name="reason" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Пример:
Установить режим для диапазона алиасов и всех принадлежащих им интерфейсов
Запрос: http://192.168.1.21:9999/commands/alias_set
Параметры:
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="set_alias_properties.xsd"> <aliases addr="24053{0-1}" iface="_" domain="biysk.local"> <property name="regime" value="accsusp"/> </aliases> </in>
Hc_ alias_declare
Команда предназначена для создания алиасов в домене.
Аналог команды в CoCon:
domain/<DOMAIN>/alias/declare
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_declare
Код HTTP-ответа:
- 201 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с ответом:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="error.xsd" /> <!-- causeType--> <xs:simpleType name="causeType"> <xs:restriction base="xs:string"> <xs:enumeration value="already_exists"/> <xs:enumeration value="licence_limit"/> <xs:enumeration value="domain_limit"/> <xs:enumeration value="no_such_iface"/> <xs:enumeration value="bad_owner"/> <xs:enumeration value="bad_group"/> <xs:enumeration value="cannot_get_iface"/> <xs:enumeration value="invalid_address_format"/> </xs:restriction> </xs:simpleType> <!-- warningType--> <xs:complexType name="warningType"> <xs:attribute name="cause" type="causeType"/> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="interface" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> </xs:complexType> <!-- aliasType--> <xs:complexType name="aliasType"> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="interface" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> <xs:attribute name="active" type="xs:boolean" use="required"/> </xs:complexType> <!-- successType--> <xs:complexType name="successType"> <xs:sequence> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <!-- warningsType--> <xs:complexType name="warningsType"> <xs:sequence> <xs:element name="warning" type="warningType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <!-- resultType--> <xs:complexType name="resultType"> <xs:sequence> <xs:element name="success" type="successType"/> <xs:element name="warnings" type="warningsType"/> </xs:sequence> </xs:complexType> <!-- in--> <xs:element name="in"> <xs:complexType> <xs:all> <xs:element name="request"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> <xs:attribute name="iface" type="xs:string" use="required"/> <xs:attribute name="active" type="xs:boolean" use="required"/> <xs:attribute name="owner" type="xs:string" use="optional"/> <xs:attribute name="group" type="xs:string" use="optional"/> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> <!-- out --> <xs:element name="out"> <xs:complexType> <xs:choice> <xs:element name="result" type="resultType" /> <xs:element name="error" type="errorType" /> </xs:choice> </xs:complexType> </xs:element> </xs:schema>
Пример:
Запрос:
http://192.168.1.21:9999/commands/alias_declare
<?xml version="1.0"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_alias_declare.xsd"> <request domain="biysk.local" address="240800" iface="e389d228ec0197d4" active="true" owner="sip1" group="loc.gr"/> </in>
Ответ:
<?xml version="1.0"?> <out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_alias_declare.xsd"> <result> <success/> <warnings> <warning cause="already_exists" domain="biysk.local" interface="e389d228ec0197d4" address="240800"/> </warnings> </result> </out>
Hc_alias_remove
Команда предназначена для удаления алиасов из домена.
Аналог команды в CoCon:
domain/<DOMAIN>/alias/remove
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_remove
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <!-- aliasType--> <xs:complexType name="aliasType"> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> <xs:attribute name="iface" type="xs:string" use="required"/> </xs:complexType> <!-- aliasesType--> <xs:complexType name="aliasesType"> <xs:sequence> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <!-- in--> <xs:element name="in"> <xs:complexType> <xs:sequence> <xs:element name="request"> <xs:complexType> <xs:sequence> <xs:element name="aliases" type="aliasesType"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Код HTTP-ответа:
- 204 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с ответом:
Пустой XML
Пример:
Запрос: http://192.168.23.34:9999/commands/alias_remove
<?xml version="1.0"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_alias_remove.xsd"> <request> <aliases> <alias domain="biysk.local" address="241998" iface="e389d22a93c67d80"/> </aliases> </request> </in>
Ответ: пустой xml.
Hc_alias_clean
Команда предназначена для удаления свойства алиаса домена.
Аналог команды в CoCon:
domain/<DOMAIN>/alias/clean
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/alias_clean
Код HTTP-ответа:
- 204 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла с запросом:
aliases.xsd
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- propertyTypeType--> <xs:simpleType name="propertyTypeType"> <xs:restriction base="xs:string"> <xs:enumeration value="global"/> <xs:enumeration value="domain"/> <xs:enumeration value="domain_interface"/> <xs:enumeration value="domain_address"/> <xs:enumeration value="address"/> <xs:enumeration value="profile"/> <xs:enumeration value="alias"/> </xs:restriction> </xs:simpleType> <!-- propertyType--> <xs:complexType name="propertyType"> <xs:attribute name="name" type="xs:string" use="required"/> <xs:attribute name="type" type="propertyTypeType" use="required"/> <xs:attribute name="value" type="xs:string" use="required"> <xs:annotation> <xs:documentation xml:lang="en"> For other type of properties value will be formatted specifically. Key: timetables\TIMETABLE_NAME Value: {"name":"TIMETABLE_NAME", "filters":[{"date":"DAYS_LIST_OR_DAY_TYPE_NAME","from":"FROM_HH:FROM_MM","to":"TO_HH:TO_MM"}],"properties":{"description | KEY":"VALUE"}} Sample: {"name":"tt2","filters":[{"date":"1 2 3 4 5","from":"9:0","to":"12:59"},{"date":"HOLIDAY","from":"13:0","to":"17:59"}],"properties":{"description":"Мой 2","key3":"{hello,world}"}} </xs:documentation> </xs:annotation> </xs:attribute> </xs:complexType> <!-- aliasType--> <xs:complexType name="aliasType"> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="iface" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> </xs:complexType> <!-- addressType--> <xs:complexType name="addressType"> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required"/> </xs:complexType> <!-- ifaceType--> <xs:complexType name="ifaceType"> <xs:sequence> <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required"/> </xs:complexType> <!-- errorType--> <xs:complexType name="errorType"> <xs:attribute name="iface" type="xs:string" use="required"/> <xs:attribute name="address" type="xs:string" use="required"/> <xs:attribute name="value" type="xs:string" use="required"/> </xs:complexType> <!-- Properties elements--> <xs:complexType name="ifacesType"> <xs:sequence> <xs:element name="iface" type="ifaceType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="domain" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="addressesType"> <xs:sequence> <xs:element name="address" type="addressType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="domain" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="aliasesType"> <xs:sequence> <xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="domain" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="domainType"> <xs:sequence> <xs:element name="property" type="propertyType" 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:sequence> <xs:element name="aliases" minOccurs="1" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="domain" type="xs:string" use="required"/> <xs:attribute name="addr" type="xs:string" use="optional"/> <xs:attribute name="iface" type="xs:string" use="optional"/> <xs:attribute name="prop" type="xs:string" use="optional"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <!-- out--> <xs:element name="out"> <xs:complexType> <xs:choice> <xs:element name="domain" type="domainType"/> <xs:element name="ifaces" type="ifacesType"/> <xs:element name="addresses" type="addressesType"/> <xs:element name="aliases" type="aliasesType"/> </xs:choice> </xs:complexType> </xs:element> </xs:schema>
Пример:
Запрос:
http://192.168.1.21:9999/commands/alias_clean
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="aliases.xsd"> <aliases addr="24052{0-1}" iface="_" domain="biysk.local" prop="regime" /> </in>