We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

application.lastresult is not working

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
aravindm
Posts: 14
Joined: Mon Mar 30, 2015 10:40 am

application.lastresult is not working

Post by aravindm »

Hi,

Shadow variables is not working for me. It always throws error.semantic.ECMAscript error. please help to resolve it.

Code: Select all

<form id="frm_test">
<field name="fld_test"  type="digits?length=3">
<prompt> Enter 3 digit code </prompt>
<filled>
         <value expr="fld_test" />
         <disconnect />
</filled>
<nomatch>
	<log> Nomatch value:::  <value expr="application.lastresult$[0].utterance" /></log>
         </reprompt>
</nomatch>
<noinput>
         <reprompt/>
</noinput>
</field>
</form>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: application.lastresult is not working

Post by support »

Hi,

Firstly, you will never be able to utilize the shadow varaible for an input field within a <nomatch> or <noinput> tag. Reason being, if a nomatch or noinput event occurs, the field was never populated, as the grammar was not matched. That explains the error you ere hearing and you should have seen in your logs something similar to:

Code: Select all

TypeError: fld_test$ has no properties line 1
errno: 1 exception Caught failure while attempting to evaluate an embedded value
This is essentially saying what I explained above, that the variable has no properties and therefore has no .utterance property as well, which is the cause of the ecmascript error.

One additional thing to note is that you can utilize the shadow variables by variable names. For example, you could log the utterance in your script like such:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<form id="frm_test">
  <field name="fld_test"  type="digits?length=3">
    <prompt> Enter 3 digit code </prompt>
    <filled>
	  <log>value:::  <value expr="fld_test$.utterance" /></log>
      <value expr="fld_test" />
      <disconnect />
    </filled>
    <catch event="nomatch noinput">
      <reprompt/>
    </catch>
  </field>
</form>
</vxml>
This will log the utterance spoken by the caller, when a match is supplied.

Hopefully that helps, please let us know if you have any additional questions.

Regards,
Plum Support

aravindm
Posts: 14
Joined: Mon Mar 30, 2015 10:40 am

Re: application.lastresult is not working

Post by aravindm »

For reporting purpose, i need to capture the digits entered by the user. The digits may not satisfy the grammar rule. I tried application.lastresult$[0].utterance in nomatch event which is not working. Please let me know is there any other way to capture the user entered digits.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: application.lastresult is not working

Post by support »

Hello aravindm,

The only way to achieve what you are looking to do would be to use an open ended grammar and then explicitly verify the range and values for what you have set in the <filled> block. Then anything that doesn't match what would be the "invalid" input you're looking to capture.

We don't recommend this though as it introduces unnecessary complexity over predefined grammars and could cause new errors for you.

Regards,
Plum Support

Post Reply