Hc_calls_history - Управление историей вызовов
Hc_calls_history
Команда выдает историю вызовов, включая вызовы, активные в момент запроса.
Аналог команды в CoCon:
/domain/<DOMAIN>/calls/list
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://server:port/commands/calls_history
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="hc_calls_history">
<xs:annotation>
<xs:documentation xml:lang="en">
Shows calls history on SSW.
Copyright (C) 2014, Eltex. All right reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<xs:include schemaLocation="ecm_common.xsd"/>
<!-- Types -->
<xs:simpleType name="dateTimeType">
<xs:restriction base="xs:string">
<xs:pattern value="\d{2}\.\d{2}\.\d{4}\s+\d{2}:\d{2}:\d{2}"/>
<!-- DD.MM.YYYY HH:MM:SS -->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="addressType">
<xs:restriction base="xs:string">
<xs:pattern value="%?([0-9ABCD*#])*%?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="addressListType">
<xs:restriction base="xs:string">
<xs:pattern value="(%?([0-9ABCD*#])*%?,?)*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="faxFilterType">
<xs:restriction base="xs:token">
<xs:enumeration value="success"/>
<xs:enumeration value="failed"/>
<xs:enumeration value="all"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="callsTypeType">
<xs:restriction base="xs:token">
<xs:enumeration value="active"/>
<xs:enumeration value="history"/>
<xs:enumeration value="all"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="domainType">
<xs:attribute name="name" type="nonEmptyTokenType" use="required"/>
<xs:attribute name="limit" type="xs:positiveInteger" default="50"/>
<xs:attribute name="tag" type="xs:base64Binary" use="optional"/>
<xs:attribute name="iface" type="xs:string"/>
<xs:attribute name="addr" type="addressListType">
<xs:annotation>
<xs:documentation xml:lang="en">
The list of addresses split by comma. In case of addr prefix or suffix is % - it means any digits.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="addr_a" type="addressType"/>
<xs:attribute name="addr_b" type="addressType"/>
<xs:attribute name="from_date" type="dateTimeType"/>
<xs:attribute name="to_date" type="dateTimeType"/>
<xs:attribute name="fax_filter" type="faxFilterType">
<xs:annotation>
<xs:documentation xml:lang="en">
Show calls only with faxes:
success - select calls only successfully received faxes;
failed - select calls only unsuccessfully received faxes;
all - select calls with any received faxes.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="calls_type" type="callsTypeType" default="all">
<xs:annotation>
<xs:documentation xml:lang="en">
Selected calls' type:
active - select only active calls;
history - select only released calls;
all - select active and released calls.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="call_id" type="nonEmptyTokenType" use="optional"/>
<xs:attribute name="mode" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="callType">
<xs:attribute name="call_id" type="nonEmptyTokenType"/>
<xs:attribute name="branch_id" type="xs:nonNegativeInteger"/>
<xs:attribute name="parent_branch_id" type="xs:string"/>
<xs:attribute name="call_ref" type="xs:integer"/>
<xs:attribute name="stage" type="nonEmptyTokenType"/>
<xs:attribute name="oaddr_a" type="addressType"/>
<xs:attribute name="oaddr_b" type="addressType"/>
<xs:attribute name="addr_a" type="addressType"/>
<xs:attribute name="addr_b" type="addressType"/>
<xs:attribute name="ni_a" type="nonEmptyTokenType"/>
<xs:attribute name="ni_b" type="nonEmptyTokenType"/>
<xs:attribute name="release_initiator" type="nonEmptyTokenType"/>
<xs:attribute name="start_time" type="nonEmptyNormalizedStringType"/>
<xs:attribute name="alerting_time" type="xs:normalizedString"/>
<xs:attribute name="answer_time" type="xs:normalizedString"/>
<xs:attribute name="release_time" type="xs:normalizedString"/>
<xs:attribute name="duration_time" type="xs:integer"/>
<xs:attribute name="display_name_a" type="xs:normalizedString"/>
<xs:attribute name="display_name_b" type="xs:normalizedString"/>
<xs:attribute name="codec_a" type="xs:string" use="optional"/>
<xs:attribute name="codec_b" type="xs:string" use="optional"/>
<xs:attribute name="category_a" type="xs:token"/>
<xs:attribute name="category_b" type="xs:token"/>
<xs:attribute name="iface_a" type="xs:token"/>
<xs:attribute name="iface_b" type="xs:token"/>
<xs:attribute name="trunk_group_id_a" type="xs:token"/>
<xs:attribute name="trunk_group_id_b" type="xs:token"/>
<xs:attribute name="call_record_a" type="xs:string"/>
<xs:attribute name="call_record_b" type="xs:string"/>
<xs:attribute name="success_faxes" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
The list of successfully received faxes, associated with current call. Urls splitted by space.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="failed_faxes" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
The list of successfully received faxes, associated with current call. Urls splitted by space.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="url_list" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
Obsolete attribute.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="release_cause" type="xs:string"/>
<xs:attribute name="release_cause_isup" type="xs:string"/>
<xs:attribute name="mode" type="xs:string" use="optional"/>
</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="nonEmptyTokenType" use="required"/>
<xs:attribute name="tag" type="xs:base64Binary" use="optional"/>
</xs:complexType>
<!-- End of types -->
<!-- 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>
<!-- /in -->
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:choice>
<xs:element name="response">
<xs:complexType>
<xs:all>
<xs:element name="domain" type="domainOutType" minOccurs="1" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="error" type="errorType" minOccurs="1" maxOccurs="1"/>
</xs:choice>
</xs:complexType>
</xs:element>
<!-- /out -->
</xs:schema>
Запрос:
http://192.168.1.21:9999/commands/calls_history
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="hc_calls_history.xsd">
<request>
<domain name="biysk.local" from_date="13.02.2020 12:00:00" limit="10"/>
</request>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_calls_history.xsd">
<response>
<domain name="biysk.local" tag="g2gEZAADdGFnZAAHaGlzdG9yeWgCZAAIZGF0ZXRpbWVoAmgDYgAAB+RhAmENaANhDGEzYRBsAAAAAmgCZAAFc3RhcnRrABMxMy4wMi4yMDIwIDEyOjAwOjAwaAJkAApjYWxsc190eXBlZAADYWxsag==">
<call release_initiator="A" release_cause_isup="16" release_cause="normal" trunk_group_id_b="ems1" duration_time="0" mode="normal" addr_b="245988" addr_a="4957979088" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245988" oaddr_a="4957979088" stage="released" release_time="13.02.2020 13:28:38" start_time="13.02.2020 13:28:28" parent_branch_id="" branch_id="0" call_id="062d8c74c686056e" call_ref="3540419372"/>
<call release_initiator="A" release_cause_isup="102" release_cause="normal" trunk_group_id_b="ems1" duration_time="0" mode="normal" addr_b="245988" addr_a="9629898491" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245988" oaddr_a="9629898491" stage="released" release_time="13.02.2020 13:28:27" start_time="13.02.2020 13:28:02" parent_branch_id="" branch_id="0" call_id="062d8c732ec3cba0" call_ref="3431907367"/>
<call release_initiator="A" release_cause_isup="18" release_cause="aPtyDisc" trunk_group_id_b="biysk.local.ssw.gr.trunk.autoname" duration_time="0" mode="normal" addr_b="246077" addr_a="9606732801" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems2" iface_a="smg-4" oaddr_b="246077" oaddr_a="9606732801" stage="released" release_time="13.02.2020 13:20:20" start_time="13.02.2020 13:19:55" parent_branch_id="" branch_id="0" call_id="062d8c54b4ca187c" call_ref="1388627508"/>
<call release_initiator="A" release_cause_isup="16" release_cause="normal" trunk_group_id_b="ems1" duration_time="0" mode="normal" addr_b="245906" addr_a="9609374213" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245906" oaddr_a="9609374213" stage="released" release_time="13.02.2020 13:16:00" start_time="13.02.2020 13:15:45" parent_branch_id="" branch_id="0" call_id="062d8c45155f92bd" call_ref="340089808"/>
<call release_initiator="A" release_cause_isup="102" release_cause="normal" trunk_group_id_b="biysk.local.ssw.gr.trunk.autoname" duration_time="0" mode="normal" addr_b="246653" addr_a="9069020153" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems2" iface_a="smg-4" oaddr_b="246653" oaddr_a="9069020153" stage="released" release_time="13.02.2020 13:07:19" start_time="13.02.2020 13:06:54" parent_branch_id="" branch_id="0" call_id="062d8c23ed8bcbe5" call_ref="2408417289"/>
<call release_initiator="A" release_cause_isup="102" release_cause="normal" trunk_group_id_b="biysk.local.ssw.gr.trunk.autoname" duration_time="0" mode="normal" addr_b="246653" addr_a="9069020031" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems2" iface_a="smg-4" oaddr_b="246653" oaddr_a="9069020031" stage="released" release_time="13.02.2020 13:05:16" start_time="13.02.2020 13:04:51" parent_branch_id="" branch_id="0" call_id="062d8c1c3c76601d" call_ref="1892446865"/>
<call release_initiator="A" release_cause_isup="16" release_cause="normal" trunk_group_id_b="ems1" duration_time="0" mode="normal" addr_b="245658" addr_a="4952580974" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="localSubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245658" oaddr_a="4952580974" stage="released" release_time="13.02.2020 12:57:36" start_time="13.02.2020 12:57:25" parent_branch_id="" branch_id="0" call_id="062d8c005bf38e9f" call_ref="21753760"/>
<call release_initiator="A" release_cause_isup="38" release_cause="ss7Failure" trunk_group_id_b="ems1" duration_time="0" mode="normal" addr_b="245658" addr_a="4952580974" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="localSubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245658" oaddr_a="4952580974" stage="released" release_time="13.02.2020 12:57:25" start_time="13.02.2020 12:57:05" parent_branch_id="" branch_id="0" call_id="062d8bff16748e40" call_ref="4232474822"/>
<call release_initiator="A" call_record_a="http://system.restfs.ecss:9990/domain/biysk.local/records/2020_02_13/2020-02-13_12-51-56_o_9585007440-240644.wav" release_cause_isup="16" release_cause="normal" duration_time="2" mode="normal" addr_b="240644" addr_a="9585007440" trunk_group_id_a="smg-4" category_b="ordinarySubscriber" category_a="ordinarySubscriber" codec_b="PCMA,PCMU,G722,telephone-event,H264,H263-1998" codec_a="PCMA,telephone-event" iface_b="240644@biysk.local" iface_a="smg-4" oaddr_b="240644" oaddr_a="9585007440" stage="released" release_time="13.02.2020 12:52:01" answer_time="13.02.2020 12:51:58" alerting_time="13.02.2020 12:51:56" start_time="13.02.2020 12:51:56" parent_branch_id="" branch_id="0" call_id="062d8bebca132453" call_ref="2936672348"/>
<call release_initiator="A" release_cause_isup="31" release_cause="normal" trunk_group_id_b="ems1" duration_time="0" mode="normal" addr_b="245708" addr_a="9671345216" trunk_group_id_a="smg-4" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245708" oaddr_a="9671345216" stage="released" release_time="13.02.2020 12:51:40" start_time="13.02.2020 12:51:16" parent_branch_id="" branch_id="0" call_id="062d8be946df45d3" call_ref="2768690064"/>
</domain>
</response>
</out>
В данном примере возвращается поле tag, которое необходимо передавать в последующем запросе, чтобы продолжить выборку. Если необходимо начать выборку с начала, необходимо в запросе опускать поле tag.
Hc_purge_calls_db
Команда удаляет устаревшие записи в БД вызовов.
Аналог команды в CoCon:
/domain/<DOMAIN>/calls/purge
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://server:port/commands/purge_calls_db
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="hc_purge_calls_db">
<xs:annotation>
<xs:documentation xml:lang="en">
Purge old records from calls_db database.
Copyright (C) 2014, Eltex. All right reserved.
</xs:documentation>
</xs:annotation>
<xs:include schemaLocation="error.xsd"/>
<xs:include schemaLocation="ecm_common.xsd"/>
<!-- Types -->
<xs:simpleType name="argType">
<xs:restriction base="xs:string">
<!-- DD.MM.YYYY HH:MM:SS | N day|week|month|year, N - integer -->
<xs:pattern value="(\d{2}\.\d{2}\.\d{4}\s+\d{2}:\d{2}:\d{2}){1}|[1-9]{1}\d*\s+(day|week|month|year){1}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="domainType">
<xs:attribute name="name" type="nonEmptyTokenType" use="required"/>
<!-- <xs:attribute name="arg" type="argType" use="required"/> -->
<xs:attribute name="arg" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="domainOutType">
<xs:sequence>
<xs:element name="ok" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:attribute name="affected"
type="xs:nonNegativeInteger"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="nonEmptyTokenType" use="required"/>
</xs:complexType>
<!-- End of types -->
<!-- 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>
<!-- /in -->
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:choice>
<xs:element name="response">
<xs:complexType>
<xs:all>
<xs:element name="domain"
type="domainOutType"
minOccurs="1" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="error" type="errorType"
minOccurs="1" maxOccurs="1"/>
</xs:choice>
</xs:complexType>
</xs:element>
<!-- /out -->
</xs:schema>
Запрос:
http://192.168.1.21:9999/commands/purge_calls_db
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="hc_purge_calls_db.xsd">
<request>
<domain name="biysk.local" arg="15.11.2019 15:00:00"/>
</request>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_purge_calls_db.xsd">
<response>
<domain name="biysk.local">
<ok affected="508"/>
</domain>
</response>
</out>