| CCXML Voxeo 1.0 Development Guide | Home | Frameset Home |
|
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<var name="state0" expr="'init'"/>
<eventhandler statevariable="state0">
<transition state="'init'" event="ccxml.loaded">
<createcall dest="'tel:1112223333'"
timeout="'60000'"
voxeo-cpa-maxsilence="'1000'"
voxeo-cpa-maxtime="'4000'"
voxeo-cpa-runtime="'20000'"
voxeo-cpa-maskstop="'beep, faxtone, modem, ring, sit, human, machine'"
voxeo-cpa-maskevent="'beep, faxtone, modem, ring, sit, human, machine'"/>
</transition>
<transition event="voxeo.cpa.result" name="evt">
<log expr="'*** CPA says [' + evt.type + '] ***'"/>
<exit/>
</transition>
<transition state="'calling'" event="connection.CONNECTION_FAILED">
<log expr="'*** CALL FAILED ***'"/>
<exit/>
</transition>
<transition event="call.CALL_INVALID" name="evt">
<exit/>
</transition>
<transition event="error.*" name="evt">
<log expr="'*** AN ERROR HAS OCCURRED (' + evt.error + ') ***'"/>
<exit/>
</transition>
</eventhandler>
</ccxml>
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<var name="state0" expr="'init'"/>
<var name="DlgActive" expr="'no'"/>
<var name="lastCPAEventTime" expr="new Date().getTime()"/> <var name="DlgExitStatus" expr="'unforced'"/>
<eventhandler statevariable="state0">
<transition state="'init'" event="ccxml.loaded" name="evt">
<createcall dest="'tel:15555555555'"
timeout="'60000'"
voxeo-cpa-runtime="'60000ms'"
voxeo-cpa-maxtime="'4000ms'"
voxeo-cpa-maxsilence="'1000ms'"
voxeo-cpa-maskevent="'human,machine,beep'"
voxeo-cpa-maskstop="''"
name="call_0"/>
</transition>
<transition event="connection.CONNECTION_CONNECTED" name="evt">
<log expr="'*** CALL CONNECTED -- WAITING FOR CPA ***'"/>
</transition>
<transition event="connection.CONNECTION_FAILED" name="evt">
<log expr="'*** CALL FAILED [' + evt.callid + '] ***'"/>
<log expr="'*** REASON [' + evt.error + '] ***'"/>
<exit/>
</transition>
<transition event="voxeo.cpa.result" name="evt">
<log expr="'*** CPA SAYS [' + evt.type + '] ***'"/>
<!-- If it has been more than 1000ms since the last time we have -->
<!-- received the 'voxeo.cpa.result' event, we will process this -->
<!-- code. This logic will simply prevent multiple CPA events, -->
<!-- such as a 'machine' and then an immediate 'beep' event, from -->
<!-- overlapping and causing a state mismatch when trying to -->
<!-- start and terminate the message dialog. -->
<if cond="new Date().getTime() - lastCPAEventTime >= 1000">
<!-- Put a new time stamp on the last time we have received the -->
<!-- 'voxeo.cpa.result' event. -->
<assign name="lastCPAEventTime" expr="new Date().getTime()"/>
<if cond="evt.type == 'human'">
<log expr="'*** HUMAN ANSWERED -- PLAY MESSAGE ***'"/>
<send event="'playMsg'" target="session.id"/>
<elseif cond="evt.type == 'machine'"/>
<log expr="'*** MACHINE ANSWERED -- PLAY MESSAGE ***'"/>
<send event="'playMsg'" target="session.id"/>
<elseif cond="evt.type == 'beep'"/>
<log expr="'*** BEEP DETECTED -- PLAY MESSAGE ***'"/>
<send event="'playMsg'" target="session.id"/>
</if>
</if>
</transition>
<transition event="user.playMsg" name="evt">
<!-- If the message dialog is not currently playing, -->
<!-- start the message dialog. -->
<if cond="DlgActive == 'no'">
<assign name="DlgActive" expr="'yes'"/>
<assign name="DlgExitStatus" expr="'unforced'"/>
<dialogstart src="'message.wav'"
type="'audio/wav'"
callid="call_0"
name="Message_Dlg"/>
<else/>
<!-- If the message dialog is currently playing, -->
<!-- stop the current dialog -->
<assign name="DlgExitStatus" expr="'forced'"/>
<dialogterminate dialogid="Message_Dlg"/>
</if>
</transition>
<transition event="dialog.exit" name="evt">
<!-- If the dialog has exited 'unforced', then the message has -->
<!-- been completely delivered. -->
<if cond="DlgExitStatus == 'unforced'">
<log expr="'*** MESSAGE PLAYED ***'"/>
<exit/>
<!-- If the dialog has been 'forced' to exit, then we send the -->
<!-- 'playMsg' event to start the message dialog over again. -->
<else/>
<log expr="'*** MESSAGE DISRUPTED -- RESTARTING MESSAGE ***'"/>
<assign name="DlgActive" expr="'no'"/>
<send event="'playMsg'" target="session.id"/>
</if>
</transition>
<transition event="call.CALL_INVALID" name="evt">
<if cond="call_0 == evt.callid">
<log expr="'*** CALL DISCONNECTED -- EXIT ***'"/>
<exit/>
</if>
</transition>
<transition event="error.*" name="evt">
<log expr="'*** AN ERROR HAS OCCURRED [' + evt.error + '] ***'"/>
<exit/>
</transition>
</eventhandler>
</ccxml>
<filled>, <noinput>, or a <nomatch> event.<field>, and each document hits a database. Let's further assume that each fetch of these seven documents takes 2 seconds to load and parse, (a conservative estimate!). In this case, your first <audio> file or TTS prompt would not be played for 14 seconds! Even if that first <audio> was located in the very first document, the VoiceXML Form Interpretation Algorithm (FIA) as described by the W3C in the VoiceXML2.1 specification would dictate that we would indeed have a 14 second delay, a period of initial silence upon call pickup that most of our callers would find unpalatable.<submit> to the "real" application start document as a condition of your <noinput> and <nomatch> handlers. (Be sure to set your timeout property to an extremely low value. This will cause the <noinput> and <nomatch> events to fire almost instantaneously.) <submit> tag to fill the painfully long fetch time to your "real' application start document with pretty, pretty music.
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.0">
<!-- stubfile.asp -->
<var name="voxeo-cpa-result" expr="'<%
=Request.Querystring("voxeo-cpa-result") %>'"/>
<form>
<block>
<log expr="'##########################################'"/>
<log expr="'### CPA Says: ' + voxeo-cpa-result + ' ###'"/>
<log expr="'##########################################'"/>
</block>
<field name="dummy">
<property name="timeout" value="100ms"/>
<!-- set the 'noinput' timeout to 0.1 seconds -->
<audio src="http://myserver.com/helloThere.wav">
Hello there. This is a call from Big Bird.
</audio>
<!-- create a 'garbage' grammar that will NEVER get a match -->
<grammar> [paris hilton is a boon to the human race] </grammar>
<filled>
<!-- this shouldn't ever happen -->
</filled>
<catch event="noinput nomatch">
<submit next="http://myserver.com/myCoolAppWithNaughtyDBHits.asp"
fetchaudio="myCoolWaitMusic.wav"
method="post"
namelist="voxeo-cpa-result" />
</catch>
</field>
</form>
</vxml>
<noinput> event, (and be sure to adjust your form-item's 'timeout' value!), then we can be confident that we have encountered a voicemail system.| ANNOTATIONS: EXISTING POSTS |
| login |
|