Page 1 of 1
capturing recording in nomatch
Posted: Thu Sep 02, 2010 2:24 am
by sniemetz
Hello
I have a script that works well except for one thing:
On the 3rd nomatch I want to end the loop and terminate the call. When I do this I'd like to access the last-recorded utterance.
It seems, however, that the application values are cleared when I am inside a nomatch block (attempts to use <submit> error-ed out with "$recording is not set"
How would I accomplish this?
Dummy logic:
<form>
<field name="saysomething">
<prompt>....</prompt>
<nomatch>
<prompt>Try again</prompt>
<reprompt/>
</nomatch>
<nomatch count="3">
<prompt>....</prompt>
<assign name="recording" expr="saysomething$.recording"/>
<submit namelist="recording" ............ />
</nomatch>
</field>
</form>
Thanks!
Re: capturing recording in nomatch
Posted: Thu Sep 02, 2010 8:45 am
by support
Hi,
The reason you cannot use the $recording application variable in your code is because it can only be used when there is an IVR grammar recognition, which is not the case here in the <nomatch>.
In the case where you want to capture an utterance after a nomatch, you would want to use the
<record> tag. This would allow you to record what the user is saying even in the case of a nomatch, so you can use that recording later.
The following previous post contains an IVR example of how you would accomplish this:
http://support.plumvoice.com/viewtopic.php?t=1333
Hopefully this helps!
Regards,
Plum Support
Re: capturing recording in nomatch
Posted: Fri Sep 03, 2010 1:47 am
by sniemetz
Hi
I reviewed that post but find myself in the same boat:
per the post I would do
<nomatch count="3">
<reprompt>
<record/>
</nomatch>
meaning I would have to ask the user to repeat a 4th time.
what I am essentially asking, is it possible to keep the app from discarding the utterance in case of a no match.
I don't want to tell the user "just say it a 4th time" -- because on that 4th time I could have a match... does this make sense?
<filled>
<!-- have match do something -->
</filled>
<nomatch>
<!-- no match send recording to me for QA -->
</nomatch>
Re: capturing recording in nomatch
Posted: Fri Sep 03, 2010 9:12 am
by support
Hi,
To help clarify, in the case of a nomatch, there is actually no utterance that the app could save, because an utterance is only available upon an ASR grammar match. There is no way to simultaneously record user input and try to match that input to a grammar. If you want to only prompt the user 3 times, you would essentially have to do the same thing as in the previously posted code, except you would use the <goto> tag to go to the recording after the second nomatch, rather than the third:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<property name="recordutterance" value="true"/>
<form id="getfirstname">
<field name="first_name">
<grammar src="http://vxml.plumgroup.com/grammars/firstname.php" root="firstname" type="application/srgs+xml" mode="voice"/>
<prompt bargein="false">
Please say your first name and spell it.
</prompt>
<filled>
Your recording is <value expr="first_name$.recording"/>.
</filled>
<nomatch count="1">
I'm sorry, I didn't get that.
<reprompt/>
</nomatch>
<nomatch count="2">
I'm sorry, I still didn't get that.
<goto next="#getrecording"/>
</nomatch>
</field>
</form>
<form id="getrecording">
<record name="userrecording">
<prompt>
Please say your first name and spell it one last time.
</prompt>
<filled>
<submit next="playuserrecording.php" method="post" namelist="userrecording" enctype="multipart/form-data"/>
</filled>
</record>
</form>
</vxml>
Regards,
Plum Support
Re: capturing recording in nomatch
Posted: Sat Sep 04, 2010 2:54 pm
by sniemetz
Yup got it - thanks!
Re: capturing recording in nomatch
Posted: Sat Sep 04, 2010 6:07 pm
by sniemetz
Hah!
check this out. I am coding around this issue with the following approach:
set a confidence level that is low: 0.4 or so
this will cause PV to find a match unless you're WAY off.
before I act on the match (in <filled>) i check whether the confidence is high enough for me to believe the match.
<if cond="word.confidence > 0.75">
!-- do the normal thing -->
</if>
THen I add a second field
<field name=confirm>
where I ask the user to confirm, by ready back the grammar entry I matched against.
if the user says "yes" - great - post it and we're done
if the user says no, reset the namelist and start over
In this way I effectively always have a recording (because I should always have a match) and I can let the user correct any bad match.
I have <catch> blocks to do the right thing if the user hangs up midstream.
Let me know if you want me to post code - this one eluded me for a while!
Re: capturing recording in nomatch
Posted: Tue Sep 07, 2010 9:28 am
by support
Hi,
That's a very clever way to resolve your situation. By setting a low confidence level, you will almost always have a grammar match and can act accordingly by checking against the actual confidence level of the grammar match.
Well done, sir!
Regards,
Plum Support