CCXML 1.0-W3C Development GuideHome  |  Frameset Home

  Dialog Extension: audio/wav   |  TOC  |  Dialog Extension: x-senddtmf  

Dialog extension: "x-fetchdigits"

Similar to the 'audio/wav' dialog extension, the 'application/x-fetchdigits' dialog type is much more powerful. It allows for playback of an audio file, and the acceptance of DTMF input from the caller. If the specified audio file cannot be located, you also have the option of indicating a backup TTS string to be read to the caller. The formatting for this is indicated below:


    <dialogstart src="'http://MyServer.com/MyFile.wav?termdigits=*#&amp;text=Here is the TTS&amp;voice=English-Male3&amp;maxtime=10s'" type=" 'application/x-fetchdigits' "/>


Be aware that it is possible to simply indicate a TTS string to be played in lieu of a wav file, and even to change the TTS voice/gender...but of course, you can also use the x-texttospeech' dialog extension for the very same purpose:


    <dialogstart src="'null://?termdigits=123*#&amp;voice=English-Male2&amp;text=Listen to my groovy male voice'" type="'application/x-fetchdigits'"/>


The allowable parameters that one can use when invoking this dialog extension are listed below:


Also, note that the only field that will be available in the 'dialogexit' event is called digits, and contains the DTMF characters entered before the termdigit was pressed. The below sample code illustrates this in action:



<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" 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="initState" expr="'state_1'"/>
  <var name="MyCallID"/>

  <eventprocessor statevariable="initState">

    <transition event="connection.alerting" state="state_1">
      <assign name="MyCallID" expr="event$.connectionid"/>
      <send data="'MyEvent'" target="session.id"/>
    </transition>

    <transition event="MyEvent">
        <accept connectionid="MyCallID"/>   
    </transition>

    <transition event="connection.connected" state="state_1">
      <log expr="'***** CALL WAS ANSWERED *****'"/>
      <dialogstart src="'null://?termdigits=#&amp;text=press some digits, fool'"
                        type="'application/x-fetchdigits'"/>

    </transition>
 
    <transition event="dialog.exit">
      <log expr="'**** USER PRESSED: ' + event$.values.digits"/>
      <log expr="'**** TERMCHAR: ' + event$.values.termdigit"/>

      <log expr="'Dialog exiting..'"/>
      <exit/>
    </transition>

    <transition event="error.dialog.notstarted'" state="state_1">
        <log expr="'****** ERROR.DIALOGNOTSTARTED.NAME = ' + event$.name"/>
    </transition>

  </eventprocessor>
</ccxml>


Note that you may also download the complete code for testing by clicking here. Copy and paste is SO last-century....




  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  Dialog Extension: audio/wav   |  TOC  |  Dialog Extension: x-senddtmf  

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