0

I am having trouble processing a dtmf within a record tag.

I am looking to identify the zero entered during recording and perform specific action based on the value. zero could be entered anytime before or after speaking.

With the following snippet I see that when I enter zero, the application exits. It looks like the block tag is reached, but then processing terminates. I am not sure what the problem is here. Or is there a better way to acheive the same?

I also referred the answer here: VoiceXML - Recognize DTMF in Recording, but need more details.

<form id="recordMessage">
<property name="termchar" value="" />
<property name="inputmodes" value="dtmf" />

<var name="lastdtmfchar" expr="1"/>

<record name="recording"  beep="true" maxtime="120s"  dtmfterm="false" type="audio/wav">
  <grammar mode="dtmf" version="1.0" root="dtmfSettings" xmlns="http://www.w3.org/2001/06/grammar">
     <rule id="dtmfSettings" >
        <one-of>
           <item>0</item>
           <item>#</item>               
        </one-of>
     </rule>
  </grammar>
    <filled>
    <assign name="lastdtmfchar" expr="recording$.termchar"/>        
    <if cond = "recording$.termchar == '#'">
    <prompt> Hash entered
    </prompt>           
    </if>
    <if cond = "recording$.termchar == '0'">
        <prompt> zero entered
    </prompt>
    </if>
    </filled>       
</record>   
<block>
    <if cond = "lastdtmfchar == '1'">   
    <prompt>  block value not assigned
    </prompt>
    </if>   
    <if cond = "lastdtmfchar == '#'">
        <prompt> block hash entered
    </prompt>           
    </if>
    <if cond = "lastdtmfchar == '0'">
        <prompt> block zero entered
    </prompt>
            </if>
</block> 

There is only this record tag in the form, but the root doc has all the handlers..

<vxml .....>
<catch event="connection.disconnect.hangup">
    <goto next="${hangupUrl}?cause=hangup" />
</catch>
<catch event="connection.disconnect">
    <goto next="${hangupUrl}?cause=disconnect" />
</catch>
<catch event="error">
    <prompt>
        <audio src="${goodbyeUrl">
        </audio>
    </prompt>
    <exit/>
</catch>
<catch event="*">
    <prompt>
        <audio src="${goodbyeUrl">
        </audio>
    </prompt>
    <exit/>
</catch>
<property name="termchar" value="#"/>
<link dtmf="0" next="${globalHandlerUrl}">  
</link>
</vxml>
Community
  • 1
  • 1
jeera
  • 591
  • 1
  • 7
  • 15
  • What IVR platform are you running this on? They do not all behave exactly the same. I do not think setting termchar to "" is valid and I am not sure how the platform will behave with that setting. To pickup the the terminating character you will need to set dtmfterm to true. Otherwise it should continue recording and record the dtmf input. I will need to see the complete vxml document (not just the record block) to answer why the application exits when zero is pressed. – Kevin Junghans Aug 01 '13 at 12:57
  • I have added the root document. Perhaps recording$.termchar is not getting the dtmf char since dtmfterm=false, but how can I get the grammar matched character? Maybe there is a simple answer. – jeera Aug 01 '13 at 15:40
  • Yes termchar didnt work. lastresult$.utterance got the '0' or '#'. – jeera Aug 01 '13 at 21:06

1 Answers1

0

As you mentioned, dtmfterm = false may be the reason. You can get the grammar matched character by accessing application.lastresult$. Refer http://www.w3.org/TR/voicexml20/#dml2.3.6 Agree with @kevin that in IVRs, a lot of things depend on the vendor itself (using a grammar in record is itself optional in the spec)

Anupam
  • 14,950
  • 19
  • 67
  • 94