Hc_megaco_gateways_add

Команда для добавления шлюза Megaco-адаптера.

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

domain/<DOMAIN>/megaco/gateways/add

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

POST

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

http://host:port/commands/megaco_gateways_add

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

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

XSD-схема XML-файла с ответом:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="gatewayType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!-- okType -->
    <xs:complexType name="okType">
        <xs:attribute name="gateway" type="xs:string" use="required"/>
    </xs:complexType>
    <!-- errorType -->
    <xs:complexType name="errorType">
        <xs:attribute name="gateway" type="xs:string" use="required"/>
        <xs:attribute name="reason" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="megaco">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="gateway" type="gatewayType" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                        <xs:attribute name="domain" type="xs:string" use="required"/>
                        <xs:attribute name="context" 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="response">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="ok" type="okType" 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>
CODE

Пример:

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

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="megaco_gateways_add.xsd">
    <megaco domain="p.city" context="ctx_local">
        <gateway name="gw1"/>
        <gateway name="gw2"/>
        <gateway name="gw3"/>
    </megaco>
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="megaco_gateways_add.xsd">
    <response>
        <ok gateway="gw2"/>
        <ok gateway="gw1"/>
        <error gateway="gw3" reason="not_found"/>
    </response>
</out>
CODE

Hc_megaco_gateways_list

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

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

domain/<DOMAIN>/megaco/gateways/list

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

POST

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

http://host:port/commands/megaco_gateways_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="gatewayType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="megaco">
                    <xs:complexType>
                        <xs:attribute name="domain" type="xs:string" use="required"/>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="out">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="gateway" type="gatewayType" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример:

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

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="megaco_gateways_list.xsd">
    <megaco domain="p.city"/>
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="megaco_gateways_list.xsd">
    <gateway name="gw1"/>
    <gateway name="gw2"/>
    <gateway name="gw3"/>
</out>
CODE

Hc_megaco_gateways_remove

Команда для удаления шлюза Megaco-адаптера.

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

domain/<DOMAIN>/megaco/gateways/remove

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

POST

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

http://host:port/commands/megaco_gateways_remove

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

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

XSD-схема XML-файла с ответом:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="gatewayType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="megaco">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="gateway" type="gatewayType" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                        <xs:attribute name="domain" type="xs:string" use="required"/>
                        <xs:attribute name="force" type="xs:string" use="optional" default="false"/>
                        <xs:attribute name="delete_ifaces" type="xs:string" use="optional" default="false"/>
                        <xs:attribute name="delete_aliases" type="xs:string" use="optional" default="false"/>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример:

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

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="megaco_gateways_remove.xsd">
    <megaco domain="p.city" force="true" delete_ifaces="true" delete_aliases="true">
        <gateway name="gw1"/>
        <gateway name="gw2"/>
        <gateway name="gw3"/>
    </megaco>
</in>
CODE

Ответ: 204