Hс_domain_pbx_create

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

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

domain/pbx-declare

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

POST

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

http://host:port/commands/domain_pbx_create

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

  • 200 – в случае успеха;
  • 206 – в случае промежуточных ответов;
  • 404 – в случае ошибки.

XSD-схема XML-файла запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <!-- typeType-->
    <xs:simpleType name="typeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="pbx10"/>
            <xs:enumeration value="pbx100"/>
            <xs:enumeration value="pbx1000"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- cityNumberType -->
    <xs:complexType name="cityNumberType">
        <xs:attribute name="value" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- requestType -->
    <xs:complexType name="requestType">
        <xs:sequence>
            <xs:element name="city_number" type="cityNumberType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="pbx_name" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    The name of the creating virtual PBX.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="type" type="typeType" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    The type of the created PBX.
                    pbx10  - three digits numbers, no more than 10 subscribers;
                    pbx100 - three digits numbers, no more than 100 subscribers;
                    pbx1000 - four digits numbers, no more than 1000 subscribers.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="default_ss_profile" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    the name of the system profile name to be copied in the creating virtual PBX.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="alias_limit" type="xs:positiveInteger" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Limit to the number of aliases.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="external_call_limit" type="xs:positiveInteger" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Limit to the number of external calls (calls from/to PBX).
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="total_call_limit" type="xs:positiveInteger" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Limit to the number of calls in PBX.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="sip_ip_set" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    The name of the SIP's IP set.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="parent_pbx" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    The name of the PXB to make external calls.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="parent_routing_context" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    The default routing context for incoming calls from creating PBX to the parent PBX.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="parent_np" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    The name of the numbering plan in the ParentPXB for created PBX.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="force" type="xs:boolean" use="optional" default="true">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Declare PBX domain without any questions, notify messages.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- sipUserType -->
    <xs:complexType name="sipUserType">
        <xs:attribute name="uri" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    SIP user's URI.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="login" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    SIP user's login.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="password" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    SIP user's password.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- coconUserType -->
    <xs:complexType name="coconUserType">
        <xs:attribute name="login" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    CoCon's user login.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="password" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    CoCon's user password.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- resultType -->
    <xs:complexType name="resultType">
        <xs:sequence>
            <xs:element name="cocon_user" type="coconUserType" minOccurs="1" maxOccurs="1"/>
            <xs:element name="sip_user" type="sipUserType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <!-- errorType -->
    <xs:complexType name="errorType">
        <xs:attribute name="description" type="xs:string" use="optional"/>
    </xs:complexType>

    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request" type="requestType"/>
            </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>
CODE

Пример

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

<?xml version="1.0" encoding="UTF-8"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_domain_pbx_create.xsd">
    <request pbx_name="pbx100_new" type="pbx10" alias_limit="10" external_call_limit="5" total_call_limit="7" sip_ip_set="ipset2" 
             parent_pbx="biysk.local" parent_routing_context="ctx_from_local" parent_np="np_240" force="true">
        <city_number value="240475" />
        <city_number value="240471" />
    </request>
</in>
CODE

Ответ:

Код: 201