Hc_media_resource - Команды управления медиа-ресурсами
В данном разделе описаны команды по управлению подключенными медиа-серверами к ECSS-10.
Hc_media_resource_declare
Команда для декларации подключения медиа-сервера к ECSS-10.
Аналог команды в CoCon:
/system/media/resource/declare
Шаблон URL запроса:
http://host:port/commands/media_resource_declare
Коды ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 - в случае успеха;
- 404 - в случае ошибки.
XML-схема:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Declares properties of media resource.
Usage: http://server:9999/commands/media_resource_declare.
Implementation: hc_media_registrar_clean.erl.
Git: git@git.eltex.loc:httpTerminal.git.
Copyright (c) 2016, Eltex. All rights reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<!-- resultType-->
<xs:complexType name="resultType">
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="declared" type="mediaResourceType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="error" type="mediaErrorType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="mediaErrorType">
<xs:attribute name="reason" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="mediaResourceType">
<xs:attribute name="node" type="xs:string" use="required"/>
<xs:attribute name="uri" type="xs:string" use="required"/>
<xs:attribute name="zone" type="xs:string" use="required"/>
<xs:attribute name="site" type="xs:string" use="required"/>
<xs:attribute name="active" type="xs:boolean" use="required"/>
</xs:complexType>
<xs:complexType name="declaredMediaResourceType">
<xs:attribute name="property" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="errorMediaResourceType">
<xs:attribute name="property" type="xs:string" use="required"/>
<xs:attribute name="reason" 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="media_resource" type="mediaResourceType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</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
Пример
Запрос:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_media_resource_declare.xsd">
<request>
<media_resource site="local" zone="default" uri="bond1.476@msr_2" node="core1@ecss1" active="true"/>
</request>
</in>
Ответ:
<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_resource_declare.xsd">
<result/>
</out>
Ошибка:
<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_resource_declare.xsd">
<result>
<error reason="already_declared" value="bond1.2@msr_1"/>
</result>
</out>
Hc_media_resource_info
Команда для просмотра информации о подключении медиа-ресурса к ECSS-10.
Аналог команды в CoCon:
/system/media/resource/info
Шаблон URL запроса:
http://host:port/commands/media_resource_info
Коды ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 - в случае успеха;
- 404 - в случае ошибки.
XML-схема:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Show properties of media resource.
Usage: http://server:9999/commands/media_resource_info.
Implementation: hc_media_resource_info.erl.
Git: git@git.eltex.loc:httpTerminal.git.
Copyright (c) 2016, Eltex. All rights reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<!-- mediaResourceType -->
<xs:complexType name="mediaResourceType">
<xs:attribute name="node" type="xs:string" use="required"/>
<xs:attribute name="sip_uri" type="xs:string" use="required"/>
<xs:attribute name="sip_status" type="xs:string" use="required"/>
<xs:attribute name="cc_status" type="xs:string" use="required"/>
<xs:attribute name="cc_id" type="xs:string" use="required"/>
<xs:attribute name="address" type="xs:string" use="required"/>
<xs:attribute name="register_time" type="xs:string" use="required"/>
<xs:attribute name="expired" type="xs:string" use="required"/>
<xs:attribute name="iface" type="xs:string" use="required"/>
<xs:attribute name="declare" type="xs:boolean" use="required"/>
<xs:attribute name="active" type="xs:boolean" use="required"/>
<xs:attribute name="zone" type="xs:string" use="required"/>
<xs:attribute name="site" type="xs:string" use="required"/>
</xs:complexType>
<!-- resultType-->
<xs:complexType name="resultType">
<xs:sequence>
<xs:element name="media_resource" type="mediaResourceType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- in-->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request">
<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/media_resource_info
Запрос:
<?xml version="1.0"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_media_resource_info.xsd">
<request/>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_resource_info.xsd">
<result>
<media_resource node="core1@ecss1" sip_uri="bond1.2:SIP61@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.2:SIP61(192.168.2.61)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="bond1.2:SIP62@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:58:32" expired="150" iface="bond1.2:SIP62(192.168.2.62)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="bond1.2@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="192.168.2.21:5700" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.2(192.168.2.21)" declare="true" active="true" zone="default" site="local"/>
<media_resource node="core1@ecss1" sip_uri="bond1.2@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="192.168.2.22:5700" register_time="2019/11/13 15:57:36" expired="94" iface="bond1.2(192.168.2.22)" declare="true" active="true" zone="default" site="local"/>
<media_resource node="core1@ecss1" sip_uri="bond1.3:MYSQL@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.3:MYSQL(192.168.1.71)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="bond1.3@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.3(192.168.1.21)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="bond1.3@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:36" expired="94" iface="bond1.3(192.168.1.22)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="bond1.476@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.476(10.16.33.5)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="bond1.476@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:36" expired="94" iface="bond1.476(10.16.33.6)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="lo@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="lo(127.0.0.1)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss1" sip_uri="lo@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:36" expired="94" iface="lo(127.0.0.1)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.2:SIP61@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.2:SIP61(192.168.2.61)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.2:SIP62@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:36" expired="94" iface="bond1.2:SIP62(192.168.2.62)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.2@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="192.168.2.21:5700" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.2(192.168.2.21)" declare="true" active="true" zone="default" site="local"/>
<media_resource node="core1@ecss2" sip_uri="bond1.2@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="192.168.2.22:5700" register_time="2019/11/13 15:57:37" expired="95" iface="bond1.2(192.168.2.22)" declare="true" active="true" zone="default" site="local"/>
<media_resource node="core1@ecss2" sip_uri="bond1.3:MYSQL@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.3:MYSQL(192.168.1.71)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.3@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.3(192.168.1.21)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.3@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:37" expired="95" iface="bond1.3(192.168.1.22)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.476@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="bond1.476(10.16.33.5)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="bond1.476@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:37" expired="95" iface="bond1.476(10.16.33.6)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="lo@msr_1" sip_status="registered" cc_status="connected" cc_id="22abcd" address="" register_time="2019/11/13 15:57:30" expired="88" iface="lo(127.0.0.1)" declare="false" active="false" zone="" site=""/>
<media_resource node="core1@ecss2" sip_uri="lo@msr_2" sip_status="registered" cc_status="connected" cc_id="c5b9d8" address="" register_time="2019/11/13 15:57:37" expired="95" iface="lo(127.0.0.1)" declare="false" active="false" zone="" site=""/>
</result>
</out>
Hc_media_resource_purge
Команда для удаления старых, не активных подключений медиа-ресурсов к ECSS-10.
Аналог команды в CoCon:
/system/media/resource/purge
Шаблон URL запроса:
http://host:port/commands/media_resource_purge
Коды ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 - в случае успеха;
- 404 - в случае ошибки.
XML-схема:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Purge properties of media resource.
Usage: http://server:9999/commands/media_resource_purge.
Implementation: hc_media_resource_purge.erl.
Git: git@git.eltex.loc:httpTerminal.git.
Copyright (c) 2016, Eltex. All rights reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<!-- resultType-->
<xs:complexType name="resultType">
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="success" type="nodeResType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="error" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="nodeType">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="sipUriType">
<xs:attribute name="sip_uri" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="nodeResType">
<xs:sequence>
<xs:element name="deleted" type="sipUriType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="node" 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="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</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/commands/media_resource_purge
Запрос:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_media_resource_purge.xsd">
<request>
<node name="core1@ecss2"/>
</request>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_resource_purge.xsd">
<result>
<success node="core1@ecss2"/>
</result>
</out>
Hc_media_resource_remove
Команда для удаления информации о настройках медиа-ресурса, добавленных ранее в ECSS-10.
Аналог команды в CoCon:
/system/media/resource/remove
Шаблон URL запроса:
http://host:port/commands/media_resource_remove
Коды ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 - в случае успеха;
- 404 - в случае ошибки.
XML-схема:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Removes properties of media resource.
Usage: http://server:9999/commands/media_resource_remove.
Implementation: hc_media_resource_remove.erl.
Git: git@git.eltex.loc:httpTerminal.git.
Copyright (c) 2016, Eltex. All rights reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<!-- resultType-->
<xs:complexType name="resultType">
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="deleted" type="sipUriType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="resourceType">
<xs:attribute name="node" type="xs:string" use="required"/>
<xs:attribute name="uri" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="sipUriType">
<xs:attribute name="sip_uri" 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="resource" type="resourceType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</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/media_resource_remove
Запрос:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_media_resource_remove.xsd">
<request>
<resource node="core1@ecss2" uri=" bond1.2@msr_2 "/>
<resource node="core1@ecss2" uri="bond1.476@msr_2"/>
</request>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_resource_remove.xsd">
<result>
<deleted sip_uri="bond1.476@msr_2"/>
<deleted sip_uri=" bond1.2@msr_2 "/>
</result>
</out>
Hc_media_resource_set
Команда для изменения настроек медиа-ресурсов.
Аналог команды в CoCon:
/system/media/resource/set
Шаблон URL запроса:
http://host:port/commands/media_resource_set
Коды ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 - в случае успеха;
- 404 - в случае ошибки.
XML-схема:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Set properties of media resource.
Usage: http://server:9999/commands/media_resource_set.
Implementation: hc_media_resource_set.erl.
Git: git@git.eltex.loc:httpTerminal.git.
Copyright (c) 2016, Eltex. All rights reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<!-- resultType-->
<xs:complexType name="resultType">
<xs:choice>
<xs:element name="media_resource" type="mediaResourceResultType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="error" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="propertyType">
<xs:attribute name="key" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="mediaResourceType">
<xs:sequence>
<xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="node" type="xs:string" use="required"/>
<xs:attribute name="uri" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="mediaResourceResultType">
<xs:choice>
<xs:sequence>
<xs:element name="success" type="successPropertyResultType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="error" type="errorPropertyResultType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:choice>
<xs:attribute name="node" type="xs:string" use="required"/>
<xs:attribute name="uri" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="successPropertyResultType">
<xs:attribute name="property" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="errorPropertyResultType">
<xs:attribute name="property" type="xs:string" use="required"/>
<xs:attribute name="reason" 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="media_resource" type="mediaResourceType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</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/media_resource_set
Запрос:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_media_resource_set.xsd">
<request>
<media_resource node="core1@ecss2" uri="bond1.2@msr_2">
<property value="true" key="active"/>
<property value="local" key="site"/>
<property value="default" key="zone"/>
</media_resource>
</request>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_resource_set.xsd">
<result>
<media_resource node="core1@ecss2" uri="bond1.2@msr_2">
<success property="active"/>
<success property="site"/>
<success property="zone"/>
</media_resource>
</result>
</out>