Hc_calls_history

Команда выдает историю вызовов, включая вызовы, активные в момент запроса.

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

/domain/<DOMAIN>/calls/list

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

POST

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

http://server:port/commands/calls_history

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

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="pair" type="addressListType">
			<xs:annotation>
				<xs:documentation xml:lang="en">
					The list of 2 addresses split by comma.
				</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="18.11.2019 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="g2gEZAADdGFnZAAHaGlzdG9yeWgCZAAIZGF0ZXRpbWVoAmgDYgAAB+NhC2ESaANhFWEPYS1sAAAAAmgCZAAFc3RhcnRrABMxOC4xMS4yMDE5IDEyOjAwOjAwaAJkAApjYWxsc190eXBlZAADYWxsag==">
			<call release_initiator="A" release_cause_isup="31" release_cause="normal" trunk_group_id_b="biysk.local.ssw.gr.trunk.autoname" duration_time="0" mode="normal" addr_b="245440" addr_a="9663514363" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245440" oaddr_a="9663514363" stage="released" release_time="18.11.2019 22:28:37" start_time="18.11.2019 22:28:13" parent_branch_id="" branch_id="0" call_id="06261630d520541d" call_ref="3276086807"/>
			<call release_initiator="A" release_cause_isup="31" release_cause="normal" trunk_group_id_b="biysk.local.ssw.gr.trunk.autoname" duration_time="0" mode="normal" addr_b="245988" addr_a="9663353688" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" 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="9663353688" stage="released" release_time="18.11.2019 22:25:04" start_time="18.11.2019 22:24:39" parent_branch_id="" branch_id="0" call_id="062616237a9973a7" call_ref="2378864415"/>
			<call release_initiator="A" release_cause_isup="31" release_cause="normal" trunk_group_id_b="biysk.local.ssw.gr.trunk.autoname" duration_time="0" mode="normal" addr_b="246292" addr_a="9663529531" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems2" iface_a="smg-4" oaddr_b="246292" oaddr_a="9663529531" stage="released" release_time="18.11.2019 21:42:06" start_time="18.11.2019 21:41:41" parent_branch_id="" branch_id="0" call_id="0626158257642656" call_ref="155672665"/>
			<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="245923" addr_a="9614398553" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems1" iface_a="smg-4" oaddr_b="245923" oaddr_a="9614398553" stage="released" release_time="18.11.2019 21:17:54" start_time="18.11.2019 21:17:29" parent_branch_id="" branch_id="0" call_id="0626152796c017ad" call_ref="2655435888"/>
			<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="246292" addr_a="9587629725" trunk_group_id_a="biysk.local.smg.gr.trunk.autoname" category_b="unknownAtThisTime" category_a="ordinarySubscriber" codec_a="PCMA,PCMU,G729,telephone-event" iface_b="ems2" iface_a="smg-4" oaddr_b="246292" oaddr_a="9587629725" stage="released" release_time="18.11.2019 21:16:10" start_time="18.11.2019 21:15:45" parent_branch_id="" branch_id="0" call_id="0626152117c5bf2f" call_ref="2219295331"/>
		</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-ответа:

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>