Page 1 of 1

Specify the # key

Posted: Tue Feb 06, 2007 1:05 pm
by brent.russell
I am trying to specify the pound key. How am I supposed to specify special characters in and out of quotes?

Code: Select all

	  <if cond="confirmMenuChoice==#">
		<goto next="#hangUp"/>
	  <elseif cond="confirmMenuChoice==2"/>
		 <goto next="#moreinfo"/>
	  <elseif cond="confirmMenuChoice==3"/>
		 <goto next="main_menu.vxml"/>
	  </if>

Thank you,
Brent

IVR code written inside cond attribute is Javascript

Posted: Tue Feb 06, 2007 2:57 pm
by support
Brent,

The IVR code you write inside of the cond attribute is Javascript and will be evaluated. That being the case # is neither a valid variable name nor a number so you need to place it in single quotes to assure that it is evaluated and compared as a string:

Code: Select all

<if cond="confirmMenuChoice=='#'">
        <goto next="#hangUp"/>
    <elseif cond="confirmMenuChoice==2"/>
        <goto next="#moreinfo"/>
    <elseif cond="confirmMenuChoice==3"/>
        <goto next="main_menu.vxml"/>
</if>
Regards,
Plum Support

Posted: Tue Feb 06, 2007 4:06 pm
by brent.russell
After adding the quotes around the pound key...

I get "you have entered an invalid option" which is a prompt set in my nomatch.

Any idea?

Thank you

tell the IVR platform that # is an allowed input

Posted: Tue Feb 06, 2007 4:22 pm
by support
Brent,

What IVR grammar are you using to specify the allowed inputs? You need to make sure that you tell the IVR platform that # is an allowed input.

Regards,
Plum Support

Posted: Tue Feb 06, 2007 4:51 pm
by brent.russell
your right... I had 1|2 for the grammar.

Thanks for pointing that out. My mistake!

But now that raises a different issue:

here is my grammar:

Code: Select all

<grammar type="application/x-jsgf">2|3|'#'</grammar>
I also tried

Code: Select all

<grammar type="application/x-jsgf">2|3|#</grammar>
But I get errors with both. Is there a way to specify the pound key?

IVR format for using JSGF specifications

Posted: Tue Feb 06, 2007 5:18 pm
by support
Brent,

According to the JSGF specification only double quotes can be used to express strings. The IVR format you are looking for is as follows:

Code: Select all

<grammar type="application/x-jsgf">2|3|"#"</grammar>

The Javascript code inside the cond block supports both single or double quotes and so we defaulted to using single quotes to avoid having to escape double quotes.

Regards,
Plum Support