Нотификация с информацией о разговорах оператора.

XSD-схема XML-нотификации:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

    <!--AutoCompleteTimeout-->
    <xs:simpleType name="AutoCompleteTimeout">
        <xs:restriction base="xs:nonNegativeInteger">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="3600"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ConversationStatus">
        <xs:restriction base="xs:string">
            <xs:enumeration value="alerting"/>
            <xs:enumeration value="initiating"/>
            <xs:enumeration value="working"/>
            <xs:enumeration value="fax_receiving"/>
            <xs:enumeration value="fax_rejecting"/>
            <xs:enumeration value="hold"/>
            <xs:enumeration value="acw"/>
            <xs:enumeration value="released"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ConversationType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="call"/>
            <xs:enumeration value="mail"/>
            <xs:enumeration value="chat"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="Direction">
        <xs:restriction base="xs:string">
            <xs:enumeration value="in"/>
            <xs:enumeration value="out"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="Conversation">
        <xs:sequence>
            <xs:element name="additional_info" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"  />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="xs:string" use="required"/>
        <xs:attribute name="type" type="ConversationType" use="required"/>
        <xs:attribute name="status" type="ConversationStatus" use="required"/>
        <xs:attribute name="start_time" type="xs:string" use="required"/>
        <xs:attribute name="answer_time" type="xs:string" use="optional"/>
        <xs:attribute name="release_time" type="xs:string" use="optional"/>
        <xs:attribute name="fax_receiving_time" type="xs:string" use="optional"/>
        <xs:attribute name="acd" type="xs:boolean" use="required"/>
        <xs:attribute name="queue_id" type="xs:string" use="optional"/>
        <xs:attribute name="queue_description" type="xs:string" use="optional"/>
        <xs:attribute name="direction" type="Direction" use="required"/>
        <xs:attribute name="display_name_a" type="xs:string" use="required"/>
        <xs:attribute name="display_name_b" type="xs:string" use="required"/>
        <xs:attribute name="digits_a" type="xs:string" use="optional"/>
        <xs:attribute name="digits_b" type="xs:string" use="optional"/>
        <xs:attribute name="fax_receive" type="xs:boolean" use="optional"/>
        <xs:attribute name="ref" type="xs:string" use="required"/>
        <xs:attribute name="auto_complete_launched" type="xs:boolean" use="required"/>
        <xs:attribute name="auto_complete_timeout" type="AutoCompleteTimeout" use="optional"/>
        <xs:attribute name="description" type="xs:string" use="optional"/>
        <xs:attribute name="is_consult" type="xs:boolean" use="optional"/>
        <xs:attribute name="is_conference" type="xs:boolean" use="optional"/>
        <xs:attribute name="on_consultation" type="xs:boolean" use="optional"/>
        <xs:attribute name="intervention" type="xs:boolean" use="optional"/>
        <xs:attribute name="workitem_id" type="xs:string" use="optional"/>
    </xs:complexType>

</xs:schema>
XML

Пример использует технологию websocket

Пример:

В примере так же используется схема conversations_event.xsd

Уведомление по подписке:

0100000006639999200
[
  {
    "_name": "event",
    "_attributes": {
      "name": "conversations_event",
      "timestamp": "2020/12/15 09:32:03",
      "entity": "104"
    },
    "_content": [
      {
        "_name": "conversations",
        "_content": [
          {
            "_name": "conversation",
            "_attributes": {
              "id": "0647f406344ff68b",
              "call_ref": "3689684372030578994",
              "type": "call",
              "status": "alerting",
              "acd": "true",
              "direction": "in",
              "ref": "{<<\"0647f4061e402b4d\">>,182}",
              "is_consult": "false",
              "display_name_a": "................ 1",
              "display_name_b": "",
              "fax_receive": "true",
              "digits_b": "104",
              "digits_a": "101",
              "queue_id": "test_line",
              "queue_description": "",
              "start_time": "2020/12/15 09:32:03",
              "intervention": "true"
            },
            "_content": [
              {
                "_name": "additional_info"
              }
            ]
          }
        ]
      }
    ]
  }
]                      
PY