| CCXML 1.0-W3C Development Guide | Home | Frameset Home |
|
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<meta name="author" content="Jeff Menkel"/>
<meta name="copyright" content="2007 Voxeo Corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>
<var name="state0" expr="'init'"/>
<eventprocessor statevariable="state0">
<transition state="init" event="ccxml.loaded">
<createcall dest="'tel:+14071112233'"
timeout="'60s'"
voxeo-cpa-maxsilence="'100'"
voxeo-cpa-maxtime="'400'"
voxeo-cpa-runtime="'2000'"
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">
<log expr="'*** CPA says [' + event$.type + '] ***'"/>
<exit/>
</transition>
<transition state="calling" event="connection.failed">
<log expr="'*** CALL FAILED ***'"/>
<exit/>
</transition>
<transition event="connection.disconnected">
<exit/>
</transition>
<transition event="error.*">
<log expr="'*** AN ERROR HAS OCCURRED (' + event$.reason + ') ***'"/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<meta name="author" content="Jeff Menkel"/>
<meta name="copyright" content="2007 Voxeo Corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>
<var name="state0" expr="'init'"/>
<var name="DlgActive" expr="'no'"/>
<var name="lastCPAEventTime" expr="new Date().getTime()"/>
<var name="DlgExitStatus" expr="'unforced'"/>
<var name="call_0"/>
<var name="playMsg"/>
<eventprocessor statevariable="state0">
<transition state="init" event="ccxml.loaded">
<createcall dest="'tel:+14071112233"
timeout="'60000ms'"
voxeo-cpa-runtime="'60000'"
voxeo-cpa-maxtime="'4000'"
voxeo-cpa-maxsilence="'1000'"
voxeo-cpa-maskevent="'human,machine,beep'"
voxeo-cpa-maskstop="''"
connectionid="call_0"/>
</transition>
<transition event="connection.connected">
<log expr="'*** CALL CONNECTED -- WAITING FOR CPA ***'"/>
</transition>
<transition event="connection.failed">
<log expr="'*** CALL FAILED [' + event$.connectionid + '] ***'"/>
<log expr="'*** REASON [' + event$.reason + '] ***'"/>
<exit/>
</transition>
<transition event="voxeo.cpa.result">
<log expr="'*** CPA SAYS [' + event$.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="event$.type == 'human'">
<log expr="'*** HUMAN ANSWERED -- PLAY MESSAGE ***'"/>
<send name="'playMsg'" target="session.id"/>
<assign name="state0" expr="playMsg"/>
<elseif cond="event$.type == 'machine'"/>
<log expr="'*** MACHINE ANSWERED -- PLAY MESSAGE ***'"/>
<send name="'playMsg'" target="session.id"/>
<assign name="state0" expr="playMsg"/>
<elseif cond="event$.type == 'beep'"/>
<log expr="'*** BEEP DETECTED -- PLAY MESSAGE ***'"/>
<send name="'playMsg'" target="session.id"/>
<assign name="state0" expr="playMsg"/>
</if>
</if>
</transition>
<transition event="playMsg">
<!-- 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="'audiofile.wav'"
type="'audio/wav'"
connectionid="call_0"
dialogid="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">
<!-- 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 name="'playMsg'" target="session.id"/>
</if>
</transition>
<transition event="connection.disconnected">
<if cond="call_0 == event$.connectionid">
<log expr="'*** CALL DISCONNECTED -- EXIT ***'"/>
<exit/>
</if>
</transition>
<transition event="error.*">
<log expr="'*** AN ERROR HAS OCCURRED [' + event$.reason + '] ***'"/>
<exit/>
</transition>
</eventprocessor>
</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 |
|