| CCXML Voxeo 1.0 Development Guide | Home | Frameset Home |
<send name="'MyName'" event="user.MyEvent" target=" 'SomePage.xml' "/>
| delay | Data Type: (ECMAScript Expression) | Default: none - attribute is optional |
The delay attribute 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 noticeable application delay as this processes.Valid values include any ECMSScript expression that returns a string that can be interpreted as a time value. CCXML uses the Cascading Style Sheets, Level 2 [ CSS2 ] time format. Time designations consist of a non-negative real number followed by a time unit identifier. The time unit identifiers are: ms : milliseconds s : seconds Examples include: "3s", "850ms", "0.7s", ".5s" and "+1.5s". for example: Note: The delayed event queue for sending events must be maintained locally. Any events waiting to be sent must be purged when the session that issued this request terminates. | ||
| event | Data 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. | ||
| name | Data 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. | ||
| namelist | Data Type: STRING | Default: 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. | ||
| target | Data 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! | ||
| <?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> |
| <?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> |
| <?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> |
| (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 |
| ANNOTATIONS: EXISTING POSTS |
SendWordNow
|
|
| In the example above, <Send target-delay>, the <dialogterminate> element has an attribute of "sessionid". That should be "dialogid" | |
MattHenry
|
|
| Thanks for catching that; I have this corrected internally, and will be corrected when we put the new documentation Build up.
~Matt |
|
moshe
|
|
| The first example is wrong. "target" is a required attribute, even when sending a signal to the same session; use 'target="session.id"'.
|
|
moshe
|
|
| 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
|
|
| Hey Moshe,
Nice Catch! I have corrected this oversight... Thanks, ~ Michael |
|
moshe
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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 |