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" use="required"/> <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: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: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="11.10.2017 12:00:00" limit="5"/> </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="g2gCZAAHaGlzdG9yeWgCZAAIZGF0ZXRpbWVoAmgDYgAAB+FhCmELaANhDGEFYSU="> <call release_initiator="System" release_cause_isup="1" release_cause="unassignedNumber" duration_time="0" addr_b="240348" addr_a="8005559670" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="undefined" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_a="smg-4" oaddr_b="240348" oaddr_a="8005559670" stage="released" release_time="11.10.2017 14:04:29" start_time="11.10.2017 14:04:29" parent_branch_id="" branch_id="0" call_id="ec7222d726562674" call_ref="4014173828"/> <call release_initiator="System" release_cause_isup="1" release_cause="unassignedNumber" duration_time="0" addr_b="240348" addr_a="8005559670" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="undefined" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_a="smg-4" oaddr_b="240348" oaddr_a="8005559670" stage="released" release_time="11.10.2017 13:02:33" start_time="11.10.2017 13:02:33" parent_branch_id="" branch_id="0" call_id="ec6ec1b9c8802c88" call_ref="1313402710"/> <call release_initiator="A" release_cause_isup="16" release_cause="normal" duration_time="24" addr_b="240509" addr_a="9059800103" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="ordinarySubscriber" category_a="ordinarySubscriber" codec_b="PCMA,PCMU,telephone-event,H264,H263-1998" codec_a="PCMA,telephone-event" iface_b="e784f922894906fd" iface_a="smg-4" oaddr_b="240509" oaddr_a="9059800103" stage="released" release_time="11.10.2017 12:06:07" answer_time="11.10.2017 12:05:43" alerting_time="11.10.2017 12:05:38" start_time="11.10.2017 12:05:37" parent_branch_id="" branch_id="0" call_id="ec6ba66b41c7300c" call_ref="4165712927"/> </domain> </response> </out>
В данном примере возвращается поле tag, которое необходимо передавать в последующем запросе, чтобы продолжить выборку. Если необходимо начать выборку с начала, необходимо в запросе опускать поле tag.
Hc_purge_calls_db
Команда удаляет устаревшие записи в БД вызовов.
Аналог команды в CoCon:
/domain/<DOMAIN>/tts/purge_calls_db
Метод 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="11.10.2017 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="34"/> </domain> </response> </out>