CCXML 1.0-W3C Development Guide Home  |  Frameset Home


<transition>  element


The <transition> element is used to catch incoming asynchronous events. The first <transition> element encountered in the document order that matches up with a specific event will be the first one executed by the CCXML interpreter.

Once a <transition> has been encountered, the tags nested within the element will then be executed in document order. If an event is thrown, and no matching <transition> is exeistent in the document, then the event will be dropped entirely, (and there will consequently be a message in the Voxeo logger indicating that an unhandled event was encountered).

Should any subsequent events arrive while a <transition> is already in progress, this second event will be placed into the event queue for later processing.


usage

<transition cond="(ECMAScript Expression)" event="(ECMAScript Expression)" name="(variable name)" state="STRING">


attributes

cond Data Type: (ECMAScript Expression) Default: True
The cond attribute specifies an ECMAScript expression which can be evaluated to 'true' or 'false'. A condition must evaluate to 'true' in order for any enclosed operations to be performed.
event Data Type: (ECMAScript Expression) Default: none - attribute is required
The event attribute denotes the matching event type used to kick off the code contained within the <transition> element. Event types can be a user-defined, dot separated ECMAScript string of any length, or, (more commonly), it can indicate a platform-defined event type. Note that the '*' suffix is a wildcard, and will match zero or more characters of any event name.

name Data Type: (variable name) Default: none - attribute is optional
The name attribute denotes that the unique variable that is to receive the event indicated in the <transition> element.
state Data Type: STRING Default: none - attribute is required
Indicates the current possible state(s) of the eventhandler.



parents

<eventprocessor>


children

<accept>   <assign>   <createccxml>   <createconference>   <destroyconference>   <dialogstart>   <dialogterminate>   <disconnect>   <else>   <elseif>   <if>   <join>   <reject>   <send>   <unjoin>   <var>


code samples

<1.0 transition>
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml">

<meta name="author" content="Jeff Menkel"/>
<meta name="copyright" content="2007 Voxeo Corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

  <eventprocessor>

    <transition event="connection.alerting">
        <log expr="'*** Incoming call detected ***'"/>
        <accept/>
    </transition>

    <transition event="connection.connected">
      <log expr="'*** The call was answered ***'"/>
      <disconnect/>
    </transition>

    <transition event="connection.disconnected">
      <log expr="'*** Disconnecting ***'"/>
      <exit/>
    </transition>

  </eventprocessor>
</ccxml>



additional links

W3C Specification


  ANNOTATIONS: EXISTING POSTS
mtatum111
10/9/2008 3:36 PM (EDT)
can you explain the difference between the event attribute and the name attribute for <transition>

It appears that both of them are very similar.

Thanks
voxeoAlexBring
10/9/2008 4:49 PM (EDT)
Hey Melissa,
The name attribute is actually now an outdated part of the transition element. It has been replaced by a much better feature that is built into ccxml 1.0-W3C.  The newer feature is "event$". For example using it would look like this:
instead of:
[color=red]
<transition event="connection.connected" name="evnt">
<assign name="conn_id" expr="evnt.connectionid"/>
</transition>
[/color]
it would look like this:
[color=red]
<transition event="connection.connected">
<assign name="conn_id" expr="event$.connectionid"/>
</transition>
[/color]
Hope this helps to clear up any confusion, if you have any other questions please don't hesitate to ask.

Standing by,
Alex
mho
9/16/2009 3:52 PM (EDT)
Is there a way to specify multiple states in a <transition> tag.
I am only asking because the text of the description says "Indicates the current possible state(s) of the eventhandler." and this would certainly make the script look better.

I suppose we can catch the event and use a construct like:
<if cond="statevariable=='specialcase'">... </if>
that is OK but not sexy.

Thanks
Mho
jdyer
9/16/2009 6:07 PM (EDT)
Hello Mho,

Yes this can most certainly possible, you actually want to use a space delimited list. I have put together a small example to help illustrate this which you will find below:

<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<var name="myVar" expr="'init1'"/>
<var name="counter" expr="0"/>
<eventprocessor statevariable="myVar">
<transition event="ccxml.loaded">
<log expr="'******* CCXML LOADED'"/>
<send data="'goto.BlockOne'" target="session.id" delay="'1s'"/>
<send data="'user.DIE_ZOMBIE_DIE'" target="session.id" delay="'10s'"/>
</transition>
<transition event="goto.BlockOne">
<send data="'goto.BlockTwo'" target="session.id" delay="'1s'"/>
<assign name="myVar" expr="'init1'"/>
</transition>
<transition event="goto.BlockTwo">
<send data="'goto.BlockOne'" target="session.id" delay="'1s'"/>
<assign name="myVar" expr="'init2'"/>
</transition>
<transition event="SEND.SUCCESSFUL" state="init1 init2">
<log expr="'******* This happens in more then one state **'"/>
<assign name="counter" expr="counter+1"/>
<log expr="'******* Happened ' + counter + ' Times'"/>
<send data="'user.test'" target="session.id" delay="'1s'"/>
</transition>
<transition event="user.DIE_ZOMBIE_DIE">
<exit/>
</transition>
</eventprocessor>
</ccxml>


I do hope this helps, and if there are any other questions please let us know as we are most certainly standing by to assist!

Regards,

John Dyer
Customer Engineer
Voxeo Support
mysteriocharan
12/25/2011 10:50 AM (EST)
Hi,

I'm new to CCXML. Sorry if the question is silly. Can someone please tell me how the "State" property of the "Transition" event work?

Thanks,
Charan
voxeoJeffK
12/27/2011 11:58 AM (EST)
Hello Charan,

This tutorial covers it in some detail:

  http://docs.voxeo.com/ccxml/1.0-final/t_3ccxml10.htm

but basically CCXML is at its core a state machine. In practice setting the state allows for different event handling for the same event type based on the present state.

Regards,
Jeff Kustermann
Voxeo Corporation

login



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