Hc_calls_active

Команда отображает список активных разговоров.

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

/domain/<DOMAIN>/calls/list --active true

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

POST

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

http://host:port/commands/calls_active

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

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

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

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:include schemaLocation="error.xsd"/>

  <xs:complexType name="domainType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="calls_limit" type="xs:integer"/>
  </xs:complexType>

  <xs:complexType name="propertyType">
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="callType">
<!--
    <xs:sequence>
      <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
-->
    <xs:attribute name="id" type="xs:string" use="required"/>
    <xs:attribute name="call_ref" type="xs:string"/>
    <xs:attribute name="stage" type="xs:string"/>
    <xs:attribute name="ocgpn_a" type="xs:string"/>
    <xs:attribute name="ocdpn_b" type="xs:string"/>
    <xs:attribute name="start_time" type="xs:string"/>
    <xs:attribute name="alerting_time" type="xs:string"/>
    <xs:attribute name="answer_time" type="xs:string"/>
    <xs:attribute name="display_name_a" type="xs:string"/>
    <xs:attribute name="display_name_b" type="xs:string"/>
    <xs:attribute name="category_a" type="xs:string"/>
    <xs:attribute name="category_b" type="xs:string"/>
    <xs:attribute name="iface_a" type="xs:string"/>
    <xs:attribute name="iface_b" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="domainOutType">
    <xs:sequence>
      <xs:element name="call" type="callType" 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:all>
	<xs:element name="request">
	  <xs:complexType>
	    <xs:sequence>
	      <xs:element name="domain" type="domainType" minOccurs="1" maxOccurs="1"/>
	    </xs:sequence>
	  </xs:complexType>
	</xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

  <!-- out-->
  <xs:element name="out">
    <xs:complexType>
      <xs:choice>
        <!--Positive case-->
        <xs:element name="response">
          <xs:complexType>
	    <xs:all>
	      <xs:element name="domain" type="domainOutType"/>
	    </xs:all>
          </xs:complexType>
        </xs:element>
        <!--Or error-->
        <xs:element name="error" type="errorType"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
XML

Пример:

Запрос:

http://192.168.1.21:9999/commands/calls_active

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

Код ответа:

200

Ответ:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_calls_active.xsd">
    <response>
        <domain name="biysk.local">
            <call id="" call_ref="3033252287" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241000" display_name_b="" start_time="02.10.2018 12:57:55" alerting_time="02.10.2018 12:57:55" answer_time="02.10.2018 12:57:56"/>
            <call id="" call_ref="3036947638" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241001" display_name_b="" start_time="02.10.2018 12:57:56" alerting_time="02.10.2018 12:57:56" answer_time="02.10.2018 12:57:56"/>
            <call id="" call_ref="3037446783" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241002" display_name_b="" start_time="02.10.2018 12:57:56" alerting_time="02.10.2018 12:57:56" answer_time="02.10.2018 12:57:57"/>
            <call id="" call_ref="3041141736" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241003" display_name_b="" start_time="02.10.2018 12:57:57" alerting_time="02.10.2018 12:57:57" answer_time="02.10.2018 12:57:57"/>
            <call id="" call_ref="3041641576" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241004" display_name_b="" start_time="02.10.2018 12:57:57" alerting_time="02.10.2018 12:57:57" answer_time="02.10.2018 12:57:58"/>
            <call id="" call_ref="3045335875" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241005" display_name_b="" start_time="02.10.2018 12:57:58" alerting_time="02.10.2018 12:57:58" answer_time="02.10.2018 12:57:58"/>
            <call id="" call_ref="3045835816" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241006" display_name_b="" start_time="02.10.2018 12:57:58" alerting_time="02.10.2018 12:57:58" answer_time="02.10.2018 12:57:59"/>
            <call id="" call_ref="3049530097" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241007" display_name_b="" start_time="02.10.2018 12:57:59" alerting_time="02.10.2018 12:57:59" answer_time="02.10.2018 12:57:59"/>
            <call id="" call_ref="3050029889" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241008" display_name_b="" start_time="02.10.2018 12:57:59" alerting_time="02.10.2018 12:57:59" answer_time="02.10.2018 12:58:00"/>
            <call id="" call_ref="3053723989" stage="answered" iface_a="bsk1" iface_b="ems1" display_name_a="241009" display_name_b="" start_time="02.10.2018 12:58:00" alerting_time="02.10.2018 12:58:00" answer_time="02.10.2018 12:58:00"/>
        </domain>
    </response>
</out>
XML