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

Specify the # key

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
brent.russell
Posts: 50
Joined: Wed Oct 04, 2006 1:34 pm
Location: SOCAL
Contact:

Specify the # key

Post 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

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

IVR code written inside cond attribute is Javascript

Post 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
Last edited by support on Fri Jan 01, 2010 12:45 pm, edited 1 time in total.

brent.russell
Posts: 50
Joined: Wed Oct 04, 2006 1:34 pm
Location: SOCAL
Contact:

Post 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

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

tell the IVR platform that # is an allowed input

Post 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
Last edited by support on Sat Feb 20, 2010 3:35 pm, edited 3 times in total.

brent.russell
Posts: 50
Joined: Wed Oct 04, 2006 1:34 pm
Location: SOCAL
Contact:

Post 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?

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

IVR format for using JSGF specifications

Post 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

Post Reply