CallXML 3.0 Development GuideHome  |  Frameset Home


<sendevent>  element

The <sendevent> element is a tag that allows one session to send a user-defined message to another entirely separate session, such as when a <run> element has been used in the document.




usage
<sendevent id="(element id)" session ="STRING" test="CDATA" value="CDATA" value-is="STRING" value-is-not="STRING">


attributes
idData Type: (element id)Default: none - attribute is optional
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur.
session Data Type: STRINGDefault: none - attribute is required
This attribute contains the ID of the session to which the event will be sent.
Be advised, that specifying an empty session attribute will result in an error, also if the session is ceased already or never existed at all.
testData Type: CDATADefault: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
valueData Type: CDATADefault: Required
The value attribute defines the string containing the body of the event message to be sent.
value-isData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-notData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.



code samples
<3.0 sendevent_parent>
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">

<assign var="parentSessionID" value="$session.ID;"/>

  <do label="do_0" repeat="10">

<!-- this script can be editied to test all of the sendevent code -->

<!--    <run value="sendevent_session_value.xml" submit="*" method="get"
              var="timerSessionID" /> -->

<!--    <run value="sendevent_test.xml" submit="*" method="get"
          var="timerSessionID" /> -->

<!--    <run value="sendevent_valueis.xml" submit="*" method="get"
              var="timerSessionID" />  -->



    <playaudio format="audio/wav"
              value="pulse.wav"/>

    <onexternalevent value="time_out1">
      <prompt value="Your call has timed out"/>
      <hangup/>
    </onexternalevent>

    <onexternalevent value="time_out2">
      <prompt value="Your call has timed out"/>
      <hangup/>
    </onexternalevent>

    <onexternalevent value="time_out3">
      <prompt value="Your call has timed out"/>
      <hangup/>
    </onexternalevent>

  </do>

</callxml>



<3.0 sendevent-session-value>
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">

  <wait value="10s"/>

  <sendevent value="time_out1" session="$parentSessionID;"/>

</callxml>


<3.0 sendevent-test>
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">

  <wait value="3s"/>

<!-- this will not execute, as '1' is not equal to '2' -->
  <sendevent value="time_out1" session="$parentSessionID;" test="1=2"/>
  <wait value="3s"/>

<!-- this will not execute, as '1' is equal to '1' -->
  <sendevent value="time_out2" session="$parentSessionID;" test="1 != 1"/>
  <wait value="3s"/>

<!-- this will execute, as '1' is not equal to '2' -->
  <sendevent value="time_out3" session="$parentSessionID;" test="1 !=2"/>


</callxml>


<3.0 sendevent-valueis>
<?xml version="1.0" encoding="UTF-8" ?>

<callxml version="3.0">

<do value="jiggery">

  <wait value="3s"/>

<!-- this will not execute, as 'jiggery' is not equal to 'pokery' -->
  <sendevent value="time_out1" session="$parentSessionID;"
            value-is="pokery"/>

  <wait value="3s"/>

<!-- this will not execute, as 'jiggery' is equal to 'jiggery' -->
  <sendevent value="time_out2" session="$parentSessionID;"
            value-is-not="jiggery"/>

  <wait value="3s"/>

<!-- this will execute, as 'jiggery' is not equal to 'jiggery' -->
  <sendevent value="time_out3" session="$parentSessionID;"
            value-is="jiggery"/>

</do>


</callxml>




additional links
none


  ANNOTATIONS: EXISTING POSTS
Cary
3/9/2008 10:44 PM (EDT)
I'm a little lost here, onexternalevent says it's deprecated.  and looking at the <on> tag it doesn't seem to have an "externalevent" option.  What am I missing here.  I see in the example above that you are still using onexternalevent.  Is this we are are suppose to be using?
voxeojeff
3/10/2008 11:34 AM (EDT)
Hi Cary,

CallXML 3.0's <on> event functions in the same way as the older events, just with a slightly different syntax: <on event="[color=red]event:value[/color]">.

However, in this case...
[code]
<onexternalevent>
[/code]
would convert to...
[code]
<on event="externalevent">
[/code]

There is a nice example of this at the bottom of the <on> documentation page: http://docs.voxeo.com/callxml/3.0/on.htm.


Hope this helps,

Jeff
zoop
3/18/2008 6:58 PM (EDT)

Here is how it's done.

Document1 has:

<on event="externalevent:SOMEID"/>

Document2 sending to document1

<sendevent value="SOMEID" session="DOCUMENT1SESSIONID"/>


login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site