CCXML Voxeo 1.0 Development GuideHome  |  Frameset Home

This documentation is for CCXML 1.0-Voxeo, which has been superceded by CCXML 1.0-W3C. The CCXML-Voxeo platform is not being updated any longer. The CCXML 1.0-W3C version, however, has many new features and is actively being enhanced. If you're writing a new CCXML application, you should use CCXML 1.0-W3C. Click here for the CCXML 1.0-W3C documentation.
<send>  element

The <send> element allows a developer to direct user-defined events to the CCXML document. Note that all user-defined events must be prefixed by 'user.', for instance:

  <send name="'MyName'" event="user.MyEvent" target=" 'SomePage.xml' "/>



Also note that Voxeo has added to this the ability to perform HTTP requests with this tag, as well. See 'AppendixG' for more details.


usage
<send delay="(ECMAScript Expression)" event="(ECMAScript Expression)" name="(variable name)" namelist="STRING" target="(ECMAScript Expression)">


attributes
delayData Type: (ECMAScript Expression)Default: none - attribute is optional
The delayattribute is used to specify a length of time that the <send> action should be delayed. Control is immediately returned to the application, but the event indicated in the <send> tag itself will be delayed, hence, there is no noticable application delay as this processes. Also be aware that the strict time formatting in the Voxeo mimplementation allows only milliseconds to be specified, (example: '1000ms'). Be aware that the queue for sending events must be maintained locally and any events waiting to be sent must be purged when the session that issued this request terminates.

eventData Type: (ECMAScript Expression)Default: none - attribute is required
This attribute denotes the type of event being generated. User defined events may include alphanumeric charaters, and the dot "." character, but nothing else. In addition, the first character must be  an alphabetical character. Also note that case sensitivity does not apply for event type names.

nameData Type: (variable name)Default: none - attribute is optional
is an ECMAScript left-hand-side expression that is the target for the event identifier. The unique identifier for the generated event is written to the target. If not present, the event's identifier is dropped.
namelistData Type: STRINGDefault: none - attribute is optional
The namelist attribute denotes the space-separated list of variable names to be <sent>. The variables will then be available as a variable/value pair in the resultant URI querystring that is sent to the server.
targetData Type: (ECMAScript Expression)Default: none - attribute is required
The target attribute denotes the user-defined identifier for the target CCXML document. Do note that it is totally legal for a CCXML program to send an event to itself!




parents
none


children
none


code samples
<Send event> sample
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
  <eventhandler>

    <transition event="connection.CONNECTION_ALERTING" name="evt">
      <assign name="MyCallID" expr="'evt.callid'"/>
      <log expr="'The called ID is ' + evt.calledid + '.'"/>
      <send event="'MyEvent'" target="session.id"/>  
    </transition>

    <transition event="user.MyEvent" name="evt">
        <accept callid="'MyCallID'"/>
    </transition>



    <transition event="connection.CONNECTION_CONNECTED">
      <log expr="'Call was answered.'"/>
      <disconnect/>
    </transition>

    <transition event="call.CALL_INVALID">
      <exit/>
    </transition>

  </eventhandler>
</ccxml>


<Send target-delay> sample
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">

  <var name="state0" expr="'init'"/>
  <eventhandler statevariable="state0">
    <transition state="'init'" event="connection.CONNECTION_ALERTING">
      <accept/>     
    </transition>

    <transition state="'init'" event="connection.CONNECTION_CONNECTED"
                name="evt">

      <dialogstart src="'TargetDialog.vxml'" name="theDialog"/>
      <assign name="state0" expr="'dialogActive'" />
     
      <send event="'timeout'" target="session.id" delay="'20000'" />
    </transition>

    <transition state="'dialogActive'" event="dialog.exit" name="evt">
      <exit />
    </transition>

    <transition state="'dialogActive'" event="user.timeout">
      <dialogterminate dialogid="theDialog" />
    </transition>
   
   
    <transition event="call.CALL_INVALID" name="evt">
      <exit/>
    </transition>

    <transition event="error.*" name="evt">
      <log expr="'ERROR DETECTED: (' + evt.error + ')'"/>
      <exit/>
    </transition>
  </eventhandler>   
</ccxml>


<Send namelist> (via HTTP request) sample
<?xml version="1.0" encoding="UTF-8" ?>
<ccxml version="1.0">

<var name="state0" expr="'init'"/>
<var name="myVar1" expr="'foo1'"/>
<var name="myVar2" expr="'foo2'"/>

  <eventhandler statevariable="state0">

    <transition event="connection.CONNECTION_ALERTING" name="evt">
      <log expr="'*** INCOMING CALLID IS: ' + evt.callid + ' ***'"/>
      <accept/>
    </transition>

    <transition event="connection.CONNECTION_CONNECTED" name="evt">
      <log expr="'*** INCOMING CALL WAS ANSWERED ***.'"/>
<!-- ********** SEND HTTP GET REQUEST TO YOUR SERVER ********** -->
      <send event="'http.get'" target="'AnyCoolPage.php'"
            namelist="myVar1 myVar2"/>

    </transition>

<!-- **** USER DEFINED EVENT RETURNED FROM 'myCoolPage.php' *** -->
    <transition event="user.myEvent" name="evt">
      <log expr="'*** \'myReturnVar\' EQUALS: ' + evt.myReturnVar + ' ***'"/>
      <exit/>
    </transition>

<!-- ****************** GENERAL EXCEPTIONS ******************** -->
    <transition event="call.CALL_INVALID">
      <exit/>
    </transition>

    <transition event="error.*" name="evt">
      <log expr="'*** ERROR HAS OCCURED [' + evt.error + '] ***'"/>
      <exit/>
    </transition>
  </eventhandler>

</ccxml>

<sample Return>
(Assuming that our 'AnyCoolPage.php' was to write our <sent> values to a text file, this is what we would see)

myEvent
myReturnVar=foo
myReturnVar2=foo2
myReturnVar3=foo3



additional links
W3C Specification


  ANNOTATIONS: EXISTING POSTS
SendWordNow
5/21/2004 3:13 PM (EDT)
In the example above, <Send target-delay>, the <dialogterminate> element has an attribute of "sessionid". That should be "dialogid"
MattHenry
5/21/2004 3:29 PM (EDT)
Thanks for catching that; I have this corrected internally, and will be corrected when we put the new documentation Build up.

~Matt
moshe
5/28/2004 12:56 PM (EDT)
The first example is wrong. "target" is a required attribute, even when sending a signal to the same session; use 'target="session.id"'.
moshe
5/28/2004 2:48 PM (EDT)
When sending a user event, that event is a string of the form

<send target="foo" event=" 'bar' "/>

The string does not contain the prefix "user." when it's sent, only when it's received. Again, the 2nd example shows the correct format, while the first one is incorrect.
Michael.Book
5/28/2004 4:07 PM (EDT)
Hey Moshe,

Nice Catch!  I have corrected this oversight...


Thanks,

~ Michael
moshe
6/2/2004 11:55 AM (EDT)
User-defined events do not have any specific callid associated with them.

That means that after you receive a user-specified event,  and while you're in that transition, if you try to do something associated with the call the interpreter doesn't know which call you're referring to. You have to specify which callid you want to manipulate.

For example, let's say that after you receive a user-defined event you want to trigger a <dialogstart>:

(a) Before <send>ing the user event,  save the callid:

<var name="base_callid" expr="evt.callid"/>

(b) After the user event triggers, use that callid in the <dialogstart>:

<transition event="user.foo">
  <dialogstart src="'foo'" callid="base_callid" ... />
</transition>
buzzage
5/20/2006 10:45 PM (EDT)
Is namelist applicable when sending a user event? 

For example, can I say:

<send event="'MyEvent'" target="session.id" namelist="myVar"/>

the access MyVar as evt.myVar in the user event handler - like a parameter to a function?

Thx
mikethompson
5/21/2006 12:34 PM (EDT)
Hey there,

Yep, you can certainly use the namelist attribute when sending user defined events.  You would also access it as evt.MyVar.  You seem to be on the right track :).

Regards,
Mike Thompson
Voxeo Extreme Support
Lampei
7/26/2006 7:01 PM (EDT)
What file type does the receiving file (AnyCoolPage.php in the example) have to be?  It looks like it's just a text file (almost like a .js file) which sets variables.  Would you be able to set the events and variables any other way (like using the var tag or <myEvent>this_is_my_event</myEvent>)?
Thanks.
bsmith
7/26/2006 10:05 PM (EDT)
The receiving file can be of any file entension so long as the data is returned in a one variable per line format.  Currently there is no support for xml parsing.

Regards,

Ben Smith
Voxeo Corporation
Michael.Book
7/27/2006 7:18 PM (EDT)
Hi All,

We have additional information available on the HTTP send function and the expected return in Appendix G: "Send Element & HTTP Requests" - 'http://docs.voxeo.com/ccxml/1.0/appendixg_ccxml.htm'.

Do let us know if additional questions arise...


Have Fun,

~ Michael
bpcamac
7/25/2007 12:51 AM (EDT)
What is the scope of a CCXML session as defined by session.id?  i.e. If one fetches a new CCXML document and begins executing it will the session.id value change?
voxeojeff
7/25/2007 11:38 AM (EDT)
Hello,

Per the CCXML 1.0 W3C specification, session.id is defined as a globally unique string that indicates the session identifier of the executing CCXML session.  If one CCXML session fetches a new CCXML document (i.e. using <createccxml>), the value of session.id will not change, but instead a new session id will be assigned to the newly created session.

Hope this helps,

Jeff Menkel
Voxeo Corporation

login



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