| CCXML 1.0-W3C Development Guide | Home | Frameset Home |
|
<xml> and <ccxml> headers. As we will be using a Voxeo-specific dialog extension in this lesson, it is very important that we specify the Voxeo XML namespace, otherwise, our called party will hear a fat, juicy error message when we test it the first time:
<?xml version="1.0" encoding="UTF-8"?>
<!-- NOTE THAT WE *MUST* DECLARE THE xmlns ATTRIBUTE -->
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
</ccxml>
<?xml version="1.0" encoding="UTF-8"?>
<!-- NOTE THAT WE *MUST* DECLARE THE xmlns ATTRIBUTE -->
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<var name="myState" expr="'init'"/>
<var name="myOutboundConnectionID" expr="'someOutboundID'"/>
<eventprocessor statevariable="myState">
<transition event="error.*">
<log expr="'an error has occurred (' + event$.reason + ')'"/>
<voxeo:sendemail to="'yourEmail@there.com'"
from="'myApp@here.com'"
type="'debug'"
body=" 'generic error detected ! ' "/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
<exit> after we log some values). Since this is only going to happen during the period that we are dialing the outbound destination, we will want to do some state management by setting the CCXML 1.0 application state to "dialing" during this period, and set the "state" attribute of this handler accordingly. And of course, we are all hotshot CCXML developers by now, so we also add in the inevitable <log> statements that will display our connection object and event properties when this event handler is executed:
<?xml version="1.0" encoding="UTF-8"?>
<!-- NOTE THAT WE *MUST* DECLARE THE xmlns ATTRIBUTE -->
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<var name="myState" expr="'init'"/>
<var name="myOutboundConnectionID" expr="'someOutboundID'"/>
<eventprocessor statevariable="myState">
<transition event="ccxml.loaded" state="init">
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.SESSIONID = ' + event$.sessionid"/>
<log expr="'***** EVENT$.PARENT = ' + event$.parent"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<assign name="myState" expr="'dialing'"/>
</transition>
<transition event="connection.failed" state="dialing">
<log expr="'***** CONNECTION FAILED *****'"/>
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.SESSIONID = ' + event$.sessionid"/>
<log expr="'***** EVENT$.PARENT = ' + event$.parent"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<exit/>
</transition>
<transition event="error.*">
<log expr="'an error has occurred (' + event.$.reason + ')'"/>
<voxeo:sendemail to="'yourEmail@there.com'"
from="'myApp@here.com'"
type="'debug'"
body=" 'generic error detected ! ' "/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
<creatcall> element in this case, and they'd be right. In order to do this successfully, we will want to remember that "myOutboundConnectionID" variable that we set earlier, and populate the "connectionID" attribute of the <createcall> element with it. Since we are now planning on a successful call, we will want to think about doing something when the call when it's actually answered, (such as playing a dialog extension...not just yet, you eager beaver), so we will want to employ the use of our old friend, the "connection.connected" handler to tell us when this happens. And when this does happen, we will want to change our state once again to indicate to the app that we are no longer dialing. Once we have all this in place, we can start with the fun stuff:
<?xml version="1.0" encoding="UTF-8"?>
<!-- NOTE THAT WE *MUST* DECLARE THE xmlns ATTRIBUTE -->
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<var name="myState" expr="'init'"/>
<var name="myOutboundConnectionID" expr="'someOutboundID'"/>
<eventprocessor statevariable="myState">
<transition event="ccxml.loaded" state="init">
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.SESSIONID = ' + event$.sessionid"/>
<log expr="'***** EVENT$.PARENT = ' + event$.parent"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<assign name="myState" expr="'dialing'"/>
<createcall dest="'tel:4072223333'" connectionid="myOutboundConnectionID" timeout="'45s'"/>
</transition>
<transition event="connection.connected" state="dialing">
<assign name="myState" expr="'connected'"/>
<log expr="'***** CALL WAS ANSWERED *****'"/>
<log expr="'***** EVENT$.CONNECTION.CONNECTIONID = ' + event$.connection.connectionid"/>
<log expr="'***** EVENT$.CONNECTION.PROTOCOL.NAME = ' + event$.connection.protocol.name"/>
<log expr="'***** EVENT$.CONNECTION.PROTOCOL.VERSION = ' + event$.connection.protocol.version"/>
<log expr="'***** EVENT$.CONNECTION.STATE = ' + event$.connection.state"/>
<log expr="'***** EVENT$.CONNECTION.LOCAL = ' + event$.connection.local"/>
<log expr="'***** EVENT$.CONNECTION.REMOTE = ' + event$.connection.remote"/>
<log expr="'***** EVENT$.CONNECTION.ORIGINATOR = ' + event$.connection.originator"/>
</transition>
<transition event="connection.failed" state="dialing">
<log expr="'***** CONNECTION FAILED *****'"/>
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.SESSIONID = ' + event$.sessionid"/>
<log expr="'***** EVENT$.PARENT = ' + event$.parent"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<exit/>
</transition>
<transition event="error.*">
<log expr="'an error has occurred (' + event$.reason + ')'"/>
<voxeo:sendemail to="'yourEmail@there.com'"
from="'myApp@here.com'"
type="'debug'"
body=" 'generic error detected ! ' "/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
<dialogstart type="audio/wav"> extension element, which is used exclusively on the Voxeo platform. The beauty of this extension is that we don't need to invoke the VoiceXML interpreter at all, we just specify an audio file to play, and backup TTS, and the CCXML 1.0 interpretr handles the rest for us. And since this is still just a dialog, we want to make sure that we catch when the dialog exits programmatically, so we once again utilize our friend the "dialog.exit" handlers. Note carefully that we set the "state" attribute to this handler so that the only way it can be matched is when the state manager says that we are in the "connected" state.<log> followed by an <exit>. To review, when a caller hangs up midway through message delivery, we will expect to receive a "connection.disconnected" event. When the callee listens to the complete message, we can expect to see the "dialog.exit" event pop up.
<?xml version="1.0" encoding="UTF-8"?>
<!-- NOTE THAT WE *MUST* DECLARE THE xmlns ATTRIBUTE -->
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<var name="myState" expr="'init'"/>
<var name="myOutboundConnectionID" expr="'someOutboundID'"/>
<eventprocessor statevariable="myState">
<transition event="ccxml.loaded" state="init">
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.SESSIONID = ' + event$.sessionid"/>
<log expr="'***** EVENT$.PARENT = ' + event$.parent"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<assign name="myState" expr="'dialing'"/>
<createcall dest="'tel:4072223333'" connectionid="myOutboundConnectionID" timeout="'45s'"/>
</transition>
<transition event="connection.connected" state="dialing">
<assign name="myState" expr="'connected'"/>
<log expr="'***** CALL WAS ANSWERED *****'"/>
<log expr="'***** EVENT$.CONNECTION.CONNECTIONID = ' + event$.connection.connectionid"/>
<log expr="'***** EVENT$.CONNECTION.PROTOCOL.NAME = ' + event$.connection.protocol.name"/>
<log expr="'***** EVENT$.CONNECTION.PROTOCOL.VERSION = ' + event$.connection.protocol.version"/>
<log expr="'***** EVENT$.CONNECTION.STATE = ' + event$.connection.state"/>
<log expr="'***** EVENT$.CONNECTION.LOCAL = ' + event$.connection.local"/>
<log expr="'***** EVENT$.CONNECTION.REMOTE = ' + event$.connection.remote"/>
<log expr="'***** EVENT$.CONNECTION.ORIGINATOR = ' + event$.connection.originator"/>
<dialogstart src="'someFile.wav?text=This is an automated call from the H.A.L. 9000 computer system to commander David Bowman.
This message is to inform you that all pod bay doors are now closed, and re entry
to the Discovery spacecraft is forbidden. This message is too important to jeapordize it to human error.
This conversation can serve no further purpose. Goodbye.'"
type="'audio/wav'"/>
</transition>
<transition event="connection.failed" state="dialing">
<log expr="'***** CONNECTION FAILED *****'"/>
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.SESSIONID = ' + event$.sessionid"/>
<log expr="'***** EVENT$.PARENT = ' + event$.parent"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<exit/>
</transition>
<transition event="dialog.exit" state="connected">
<log expr="'***** DIALOG EXIT REACHED *****'"/>
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.DIALOGID = ' + event$.dialogid"/>
<log expr="'***** EVENT$.CONFERENCEID = ' + event$.conferenceid"/>
<log expr="'***** EVENT$.CONNECTIONID = ' + event$.connectionid"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<log expr="'***** EVENT$.DIALOG.DIALOGID = ' + event$.dialog.dialogid"/>
<log expr="'***** EVENT$.DIALOG.CONNECTIONID = ' + event$.dialog.connectionid"/>
<log expr="'***** EVENT$.DIALOG.CONFERENCEID = ' + event$.dialog.conferenceid"/>
<log expr="'***** EVENT$.DIALOG.TYPE = ' + event$.dialog.type"/>
<log expr="'***** EVENT$.DIALOG.SRC = ' + event$.dialog.src"/>
<log expr="'***** EVENT$.DIALOG.INPUT = ' + event$.dialog.input"/>
<log expr="'***** EVENT$.DIALOG.OUTPUTS = ' + event$.dialog.outputs"/>
<exit/>
</transition>
<transition event="connection.disconnected">
<log expr="'***** CONNECTION.DISCONNECT EVENT CAUGHT *****'"/>
<log expr="'***** EVENT$.NAME = ' + event$.name"/>
<log expr="'***** EVENT$.CONNECTIONID = ' + event$.connectionid"/>
<log expr="'***** EVENT$.PROTOCOL = ' + event$.protocol"/>
<log expr="'***** EVENT$.REASON = ' + event$.reason"/>
<log expr="'***** EVENT$.INFO = ' + event$.info"/>
<log expr="'***** EVENT$.CONNECTION = ' + event$.connection"/>
<log expr="'***** EVENT$.EVENTID = ' + event$.eventid"/>
<log expr="'***** EVENT$.EVENTSOURCE = ' + event$.eventsource"/>
<log expr="'***** EVENT$.EVENTSOURCETYPE = ' + event$.eventsourcetype"/>
<log expr="'***** EVENT$.TRIGGER = ' + event$.trigger"/>
</transition>
<transition event="error.*">
<log expr="'an error has occurred (' + event$.reason + ')'"/>
<voxeo:sendemail to="'yourEmail@there.com'"
from="'myApp@here.com'"
type="'debug'"
body=" 'generic error detected ! ' "/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
| ANNOTATIONS: EXISTING POSTS |
| login |
|