Hc_check_connection

Команда проверки доступности БД портала абонента.

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

domain/<DOMAIN>/subscriber-portal/check-connection

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

http://server:9999/commands/check_connection

Коды ответа:

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

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="hc_check_connection">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Command for checking connection to subscriber portal database.
            Copyright (C) 2014, Eltex. All right reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd" />
    <xs:include schemaLocation="ecm_common.xsd" />

    <!-- in -->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:attribute name="storage" type="nonEmptyTokenType" use="optional">
                            <xs:annotation>
                                <xs:documentation xml:lang="en">
                                    Deprecated attribute.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="domain" type="nonEmptyTokenType" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- in -->

    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="success" minOccurs="1" maxOccurs="1" />
                <xs:element name="error" type="errorType" minOccurs="1" maxOccurs="1" />
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <!-- out -->
</xs:schema>
CODE

Пример: 

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

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

Ответ: 200

Соединение с базой успешно установлено:

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

Ответ: 404.

При соединении произошла ошибка (не заданы параметры портала абонента).

<?xml version="1.0" encoding="UTF-8"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_check_connection.xsd">
    <error cmd="check-connection" reason="db_error" body="conn_params_is_null"/>
</out>
CODE

Hc_sp_properties_list

Команда просмотра свойств портала абонентов для всех виртуальных АТС.

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

domain/<DOMAIN>/subscriber-portal/properties/info

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

http://server:9999/commands/sp_properties_list

Коды ответа:

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

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="sp_properties_list">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Get list of subscriber portal properties for all active domains in cluster.
            Usage: http://server:9999/commands/sp_properties_list.
            Implementation: hc_sp_properties_list.erl.
            Git: git@git.eltex.loc:httpTerminal.git.
            Copyright (c) 2014, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd" />
    <xs:include schemaLocation="ecm_common.xsd" />

<!-- Types -->

    <!-- request -->
    <xs:complexType name="requestType">
        <xs:attribute name="storage" type="nonEmptyTokenType" use="optional">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Deprecated attribute.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="domain" type="nonEmptyTokenType" use="optional" />
    </xs:complexType>
    <!-- request -->

    <!-- successful response -->
    <!-- spPropertiesType-->
    <xs:complexType name="spDomainPropertiesType">
        <xs:complexContent>
            <xs:extension base="baseOptionsType">
                <xs:attribute name="web_sp_server" type="xs:string" use="optional" />
                <xs:attribute name="auto_create_account" type="xs:boolean" use="optional" />
                <xs:attribute name="auto_delete_account" type="xs:boolean" use="optional" />
                <xs:attribute name="connection" type="xs:normalizedString" use="optional" />
                <xs:attribute name="ldap_authentication_enabled" type="xs:boolean" use="optional" />
                <xs:attribute name="ldap_server_id" type="xs:normalizedString" use="optional" >
                    <xs:annotation>
                        <xs:documentation xml:lang="en">
                            LDAP/AD server id (from domain LDAP/AD servers' list
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- successful response -->

    <!-- resultType-->
    <xs:complexType name="resultType">
        <xs:all>
            <xs:element name="domain_options" type="domainInfoOutType" minOccurs="1"/>
        </xs:all>
    </xs:complexType>

<!-- Root elements -->

    <!-- 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>
    <!-- in -->

    <!-- 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>
    <!-- out -->

</xs:schema>

CODE

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

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_list.xsd">
    <request storage="ds1"/>
</in>
CODE

Ответ:

Успешный запрос.

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_list.xsd">
    <result>
        <domain_options>
            <system>
                <options xs:type="spDomainPropertiesType" web_sp_server="http://sp.web.ecss/" ldap_server_id="" ldap_authentication_enabled="false" connection="" auto_delete_account="false" auto_create_account="false"/>
            </system>
            <domain name="biysk.local">
                <options xs:type="spDomainPropertiesType" connection="Host: 192.168.1.71; Port: 3306; Login: subscribers; Password: subscribers; Database: ecss_subscribers" auto_delete_account="true" auto_create_account="true"/>
            </domain>
        </domain_options>
    </result>
</out>
CODE

Ошибка при выполнении запроса:

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

Hc_sp_properties_set

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

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

domain/<DOMAIN>/subscriber-portal/properties/set

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

http://server:9999/commands/sp_properties_set

Коды ответа:

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

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="sp_properties_list">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Set properties of subscriber portal.
            Usage: http://server:9999/commands/sp_properties_set.
            Implementation: hc_sp_properties_set.erl.
            Git: git@git.eltex.loc:httpTerminal.git.
            Copyright (c) 2014, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd" />
    <xs:include schemaLocation="ecm_common.xsd" />

    <!-- in -->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="set" minOccurs="1" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:attribute name="property" type="nonEmptyTokenType" use="required" >
                                        <xs:annotation>
                                            <xs:documentation xml:lang="en">
                                                Property connection:
                                                    Usage: Host: host; Port: port; Login: login; Password: password; Database: database
                                                        host   - The host of the MySQL server;
                                                        port   - The port of the MySQL server;
                                                        login    - MySQL server login;
                                                        password - MySQL server password;
                                                        database - MySQL server database
                                                    Sample: Host: localhost; Port: 3306; Login: mysql; Password: passwd; Database: sp-db
                                                Property web_sp_server: string
                                                Property auto_create_account: boolean
                                                Property auto_delete_account: boolean
                                                Property ldap_server_id: string
                                                Property ldap_authentication_enabled: boolean
                                                Property enable: boolean
                                            </xs:documentation>
                                        </xs:annotation>
                                    </xs:attribute>
                                    <xs:attribute name="value" type="xs:normalizedString" use="required" />
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="storage" type="nonEmptyTokenType" use="optional">
                            <xs:annotation>
                                <xs:documentation xml:lang="en">
                                    Deprecated attribute.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="domain" type="nonEmptyTokenType" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- in -->

    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="success" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:attribute name="property" type="xs:token" use="required" />
                        <xs:attribute name="old_value" type="xs:normalizedString" use="required" />
                        <xs:attribute name="new_value" type="xs:normalizedString" use="required" />
                    </xs:complexType>
                </xs:element>
                <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!-- out -->
</xs:schema>
CODE

Пример:

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

Изменение всех свойств домена biysk.local:

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_set.xsd">
    <request storage="ds1" domain="biysk.local">
        <set property="auto_create_account" value="true" />
        <set property="auto_delete_account" value="true" />
        <set property="connection" value="Host: localhost; Port: 3306; Login: user; Password: secret; Database: test" />
    </request>
</in>
CODE

Ответ:200


<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_set.xsd">
    <success property="auto_create_account" old_value="true" new_value="true"/>
    <success property="auto_delete_account" old_value="true" new_value="true"/>
    <success property="connection" old_value="{"sp.mysql.ecss",3306,"subscribers","subscribers","ecss_subscribers"}" new_value="{"localhost",3306,"user","secret","test"}"/>
</out>
CODE

Hc_sp_properties_clean

Команда для сброса политики работы с порталом абонентов.

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

domain/<DOMAIN>/subscriber-portal/properties/clean

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

http://server:9999/commands/sp_properties_clean

Коды ответа:

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

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="sp_properties_clean">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Reset to default properties of subscriber portal.
            Usage: http://server:9999/commands/sp_properties_clean.
            Implementation: hc_sp_properties_clean.erl.
            Git: git@git.eltex.loc:httpTerminal.git.
            Copyright (c) 2014, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd" />
    <xs:include schemaLocation="ecm_common.xsd" />

<!-- Root elements -->

    <!-- in -->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="clean" minOccurs="0" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:attribute name="property" type="nonEmptyTokenType" use="required"/>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="storage" type="nonEmptyTokenType" use="optional">
                            <xs:annotation>
                                <xs:documentation xml:lang="en">
                                    Deprecated attribute.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="domain" type="nonEmptyTokenType" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- in -->

    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="success" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:attribute name="property" type="nonEmptyTokenType" use="required" />
                    </xs:complexType>
                </xs:element>
                <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!-- out -->

</xs:schema>
CODE

Пример:

Запрос на сброс всех свойств:
http://192.168.1.21:9999/commands/sp_properties_clean

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_clean.xsd">
    <!-- Сбросить все свойства для всех доменов -->
    <request storage="ds1" />
</in>
CODE

Сброс всех свойств, второй вариант (если указать домен, будут сброшены все свойства для этого домена):

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_clean.xsd">
    <!-- Сбросить все свойства для всех доменов, второй вариант -->
    <request storage="ds1" domain="biysk.local" />
</in>
CODE

Ответ на запрос о сбросе всех свойств:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_clean.xsd">
    <success property="all"/>
</out>
CODE

Запрос на сброс некоторых свойств для домена:

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_clean.xsd">
    <!-- Сбросить перечисленные свойства для d.local -->
    <request storage="ds1" domain="biysk.local">
        <clean property="auto_create_account" />
        <clean property="auto_delete_account" />
    </request>
</in>
CODE

Ответ на запрос о сбросе некоторых свойств для определенного домена:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_clean.xsd">
    <success property="auto_create_account"/>
    <success property="auto_delete_account"/>
</out>
CODE

Ответ на запрос о сбросе трех свойств, при обработке одного из которых произошла ошибка:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sp_properties_clean.xsd">
    <success property="auto_create_account"/>
    <success property="auto_delete_account"/>
    <error cmd="sp_properties_clean" reason="error" body="{error,{}}" entity="connection"/>
</out>
CODE

Hc_sync

Синхронизация алиасов ECSS-10 с порталом абонентов.

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

domain/<DOMAIN>/subscriber-portal/sync

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

http://server:9999/commands/sync

Коды ответа:

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

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="sync">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Synchronizing aliases of local softswitch and aliases of subscriber portal.
            Usage: http://server:9999/commands/sync.
            Copyright (c) 2014, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd" />
    <xs:include schemaLocation="ecm_common.xsd" />

    <!-- resultType -->
    <xs:simpleType name="resultType">
        <xs:restriction base="xs:token">
            <xs:enumeration value="ok" />
            <xs:enumeration value="already_exists" />
            <xs:enumeration value="error" />
        </xs:restriction>
    </xs:simpleType>
    <!-- /resultType -->

    <!-- in -->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:attribute name="domain" type="nonEmptyTokenType" use="required" />
                        <xs:attribute name="address_range" type="nonEmptyTokenType" use="required" />
                        <xs:attribute name="iface_range" type="nonEmptyTokenType" use="required" />
                        <xs:attribute name="password" type="nonEmptyTokenType" use="optional" />
                        <xs:attribute name="verbose" type="xs:boolean" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- /in -->

    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="results" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="result" minOccurs="0" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:attribute name="alias" type="xs:string" use="required" />
                                    <xs:attribute name="login" type="xs:string" use="required" />
                                    <xs:attribute name="password" type="xs:string" use="required" />
                                    <xs:attribute name="result" type="resultType" use="required" />
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="success" type="xs:nonNegativeInteger" use="required" />
                        <xs:attribute name="fail" type="xs:nonNegativeInteger" use="required" />
                        <xs:attribute name="total" type="xs:nonNegativeInteger" use="required" />
                    </xs:complexType>
                </xs:element>
                <xs:element name="error" type="errorType" minOccurs="1" maxOccurs="1" />
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <!-- /out -->
</xs:schema>

CODE

Запрос:
http://server:9999/commands/sync

<?xml version="1.0" encoding="UTF-8"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sync.xsd">
    <request domain="biysk.local" 
             address_range="24047{3-4}" 
             iface_range="24047{3-4}@biysk.local" 
             password="password" 
             verbose="true" />
</in>
CODE

Ответ:200

Успешный запрос:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sync.xsd">
    <results success="2" fail="0" total="2">
        <result alias="240474, 06201d996900719e" login="240474" password="password" result="ok"/>
        <result alias="240473, 06201d99d02a910b" login="240473" password="password" result="ok"/>
    </results>
</out>
CODE

Ошибка при выполнении запроса:

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