Events

This section describes the event data that is associated with event types. Events are asynchronously returned to the application from the eventhandler.

XML Schema Definition for Events

The following XML schema definition provides a formal definition of all possible XML payloads that are valid with event types.

          <xs:simpleType name="event_type">
              <xs:restriction base="xs:string">
                     <xs:enumeration value="end_play" />
                     <xs:enumeration value="end_playcollect" />
                     <xs:enumeration value="end_playrecord" />
                     <xs:enumeration value="end_overlay" />
                     <xs:enumeration value="keepalive" />
                     <xs:enumeration value="incoming" />
                     <xs:enumeration value="ringing" />
                     <xs:enumeration value="connected" />
                     <xs:enumeration value="hangup" />
                                  <xs:enumeration value="info" />
                     <xs:enumeration value="dtmf" />
                     <xs:enumeration value="tone" />
                     <xs:enumeration value="any" />
              </xs:restriction>
       </xs:simpleType>
      
       <xs:simpleType name="event_data_name">
              <xs:restriction base="xs:string">
                     <xs:enumeration value="result" />
                     <xs:enumeration value="reason" />
                     <xs:enumeration value="digits" />
                     <xs:enumeration value="tone" />
                     <xs:enumeration value="duration" />
                     <xs:enumeration value="uri" />
                     <xs:enumeration value="caller_uri" />
                     <xs:enumeration value="content_type" />
                     <xs:enumeration value="content" />
                     <xs:enumeration value="transaction_id" />
              </xs:restriction>
       </xs:simpleType>

              <xs:element name="event_data">
              <xs:complexType>
                     <xs:attribute name="name" type="event_data_name" use="required" />
                     <xs:attribute name="value" type="xs:string" use="required" />
              </xs:complexType>
       </xs:element>

               <xs:simpleType name="event_resource_type">
              <xs:restriction base="xs:string">
                     <xs:enumeration value="call" />
                     <xs:enumeration value="conference" />
                     <xs:enumeration value="any" />
              </xs:restriction>
       </xs:simpleType>

       <xs:element name="event">
              <xs:complexType>
                     <xs:sequence>
                            <xs:element ref="event_data" minOccurs="0" maxOccurs="unbounded" />
                     </xs:sequence>
                     <xs:attribute name="type" type="event_type" use="required" />
                     <xs:attribute name="resource_type" type="event_resource_type" />
                     <xs:attribute name="resource_id" type="xs:string" />
              </xs:complexType>
       </xs:element>

<event> Parameters

Event parameters provide information about the specific event, such as type.

Parameter

Description

Values

type

The event type.

end_play

end_playcollect

end_playrecord

end_overlay

dtmf

tone

info

incoming

ringing

connected

hangup

keepalive

resource_type

The resource type associated with the event.

call or conference

resource_id

A unique ID.

N/A

<event_data> Parameters

Event data is provided in two parts – a description of the data (name) and then data itself.

Parameter

Description

Values

name

The name of an event data.

reason

tone

digits

duration

caller_uri

uri

content_type

content

transaction_id

value

The value of an event data.

varies

Event Types

This table contains detailed descriptions of the event types and an example of the XML payload that accompanies the event.

Event

Description

Event Payload

end_play

transaction_id

Reason:

  • Play complete

  • Play stopped

Duration in milliseconds

<web_service version="1.0">
  <event type="end_play"  
     resourceid="5974c8b5-8a3c-4a8e-ae82-
     8f7c8bd0efd5" resource_type="call">
  <event_data name="reason" value="complete" />
  <event_data name="duration" value="30000ms" />
  <event_data name="transaction_id"
     value="0974c8b5-8a3c-4a8e-ae82-
     8f7c8bd0efdd" />
  </event>
</web_service>

end_playcollect

transaction_id

Reason:

  • maxdigits

  • termdigit
    -timeout
    -tone
    -stopped

  • digits

tone

Duration in milliseconds

<web_service version="1.0">
  <event type="end_playcollect"   
      resourceid="5974c8b5-8a3c-4a8e-ae82-
      8f7c8bd0efd5" resource_type="call">
  <event_data name="reason" value="termdigit" />
  <event_data name="digits" value="1234" />
  <event_data name="transaction_id" value="0974c8b5-
      8a3c-4a8e-ae82-8f7c8bd0efdd" />
  </event>
 </web_service>

end_playrecord

transaction_id

Reason:

  • stopped

Duration in milliseconds

<web_service version="1.0">
  <event type="end_playrecord"
      resource_id="5974c8b5-8a3c-4a8e-ae82-
      8f7c8bd0efd5" resource_type="call">
  <event_data name="reason" value="timeout" />
  <event_data name="transaction_id" value="0974c8b5-
      8a3c-4a8e-ae82-8f7c8bd0efdd" />
  </event>
</web_service>

end_overlay

transaction_id

Reason:

  • termdigit

  • timeout

  • stopped

Duration in milliseconds

<web_service version="1.0">
  <event type="end_overlay" resource_id="5974c8b5-
      8a3c-4a8e-ae82-8f7c8bd0efd5"
      resource_type="call">

  <event_data name="reason" value="stop" />
  <event_data name="transaction_id" value="0974c8b5-
      8a3c-4a8e-ae82-8f7c8bd0efdd" />
  </event>
</web_service>

incoming

call_id, uri, caller_uri

<web_service version="1.0">
  <event type="incoming" resource_id="5974c8b5-8a3c-
      4a8e-ae82-8f7c8bd0efd5" resource_type="call">
  <event_data name="call_id" value="5974c8b5-8a3c-
      4a8e-ae82-8f7c8bd0efd5" />
  <event_data name="uri" value="sip:
      sip@10.20.129.8" />
  <event_data name="caller_uri"
      value="sip:10.20.129.20" />
  </event>
</web_service>

ringing

The remote party of an outbound call is ringing.

call_id

<web_service version="1.0">
   <event type="ringing" resource_id="5974c8b5-8a3c-
       4a8e-ae82-8f7c8bd0efd5" resource_type="call">
   <event_data name="call_id" value="5974c8b5-8a3c-
       4a8e-ae82-8f7c8bd0efd5" />
   </event>
</web_service>

connected

The remote party of an outbound call has answered.

call_id

Reason:

  • unknown

  • answer-machine

  • voice

  • fax

  • custom tone name

  • Media

  • audio

  • audiovideo

<web_service version="1.0">
   <event type="connected" resource_id="5974c8b5-
      8a3c-4a8e-ae82-8f7c8bd0efd5"
      resource_type="call">
   <event_data name="reason" value="voice" />
   <event_data name="media" value="audio" />
   </event>
</web_service>

hangup

The remote party has ended the call.

call_id

Reason:

  • busy-tone

  • operator-intercept voice

  • no-answer

<web_service version="1.0">
   <event type="hangup" resource_id="5974c8b5-8a3c-
       4a8e-ae82-8f7c8bd0efd5" resource_type="call">
   <event_data name="reason" value="no-answer" />
   </event>
</web_service>

info

Unsolicited user information (such as SIP INFO).

  • call_id

  • content-type

  • content        

<web_service version="1.0">
   <event type="info" resource_id="5974c8b5-8a3c-
      4a8e-ae82-8f7c8bd0efd5" resource_type="call">
   <event_data name="call_id" value="5974c8b5-8a3c-
      4a8e-ae82-8f7c8bd0efd5" />
   <event_data name="content-type" value="sdp" />
   <event_data name="content" value="[sdp]" />
   </event>
</web_service>

dtmf

Unsolicited DTMF digits.

  • call_id

  • digitscall_id

<web_service version="1.0">
    <event type="info" resource_id="5974c8b5-8a3c- 
       4a8e-ae82-8f7c8bd0efd5" resource_type="call">
    <event_data name="call_id" value="5974c8b5-
       8a3c-4a8e-ae82-8f7c8bd0efd5" />
    <event_data name="digits" value="4" />
    </event>
</web_service>

tone

Unsolicited tone detection events.

  • call_id

  • tone

<web_service version="1.0">
   <event type="tone" resource_id="5974c8b5-8a3c-
      4a8e-ae82-8f7c8bd0efd5" resource_type="call">
   <event_data name="call_id" value="5974c8b5-8a3c-
      4a8e-ae82-8f7c8bd0efd5" />
   <event_data name="tone" value="[name]" />
   </event>
</web_service>

keepalive

Once the application starts to monitor the events, the PowerMedia XMS RESTful server will send a keepalive event periodically.

<web_service version="1.0">
   <event type="keepalive" />
</web_service>