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

<var> expr attrib not evaluating properly

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
mgzeep
Posts: 7
Joined: Wed Dec 19, 2007 10:45 am

<var> expr attrib not evaluating properly

Post by mgzeep »

Hi:

I am using the <var> tag to concatenate a string in my script and it appears the the tag gets evaluated when the script loads (too soon). Here is the tag.

<var name="session_log_note_2" expr="'note_2' + ' :: ' + assetnumber + ' :: ' + priority"/>

Both "assetnumber" and "priority" are variables found earlier in the script but they evaluate to "undefined".

I don't know where I've gone off the rails here.

Thanks
Greg

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

IVR developers need code example of <var> tag issue

Post by support »

Hi,

Can you post more sample IVR code that demonstrates this IVR issue? It's a bit unclear as to where this IVR error is happening.

Regards,
Plum Support
Last edited by support on Fri Feb 19, 2010 11:50 am, edited 2 times in total.

mgzeep
Posts: 7
Joined: Wed Dec 19, 2007 10:45 am

Post by mgzeep »

I've edited this script as much as possible for readablity. I think what happens is the

Code: Select all

<var name="session_log_note_2" expr="'note_2' + ' :: ' + assetnumber + ' :: ' + priority"/>
gets evaluated immediately after the form is evaluated because of how it is nested and has nothing to do with where the <var> tag appears sequencially in the script. ??? I'm an vxml newbie so I just guessing based on what I've seen in the logs.

Thanks
Greg

Code: Select all

<form id="get_assetnumber">
	
	<var name="session_log_note_1" expr="'call begin'"/>
	<subdialog name="update_log_1" namelist="session.id session.telephone.dnis session.telephone.ani session_log_note_1" method="post" src="http://www..."/>
	
	<subdialog name="main_ivr_prompts" namelist="session.telephone.dnis" method="post" src="http://www..."/>
	
	<property name="bargein" value="true"/>
	
	<block>
		<audio expr="main_ivr_prompts.opening_file_url">
			<voice gender="female">
				<value expr="main_ivr_prompts.opening_prompt"/>
			</voice>
		</audio>
	</block>
	
	<field name="assetnumber">
		<grammar type="application/x-jsgf" mode="dtmf">
			( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | "*" | "#" )+
		</grammar>
		<filled>
			<if cond="assetnumber=='#'">
				<goto next="#record_prompts"/>
			</if>
		</filled>
		<audio expr="main_ivr_prompts.asset_number_file_url">
			<voice gender="female">
				<value expr="main_ivr_prompts.asset_number_prompt"/>
			</voice>
		</audio>
		<nomatch>
			<reprompt/>
		</nomatch>
		<noinput>
			<reprompt/>
		</noinput>
	</field>
		
	<field name="confirm">
		<grammar>
			Yes|No
		</grammar>
		...
	</field>
	
	<field name="priority">
		<grammar type="application/x-jsgf" mode="dtmf">
			( 1 | 2 | 3 )
		</grammar>
		<audio expr="main_ivr_prompts.priority_code_file_url">
			<voice gender="female">
				<value expr="main_ivr_prompts.priority_code_prompt"/>
			</voice>
		</audio>
		<nomatch>
			<reprompt/>
		</nomatch>
		<noinput>
			<reprompt/>
		</noinput>
		<filled>
			<var name="session_log_note_2" expr="'note_2' + ' :: ' + assetnumber + ' :: ' + priority"/>
			<if cond="priority==1">
				...
			<elseif cond="priority==2"/>
				...
			<else/>
				...
			</if>
		</filled>
	</field>
			
	<var name="session_log_note_2" expr="'note_2' + ' :: ' + assetnumber + ' :: ' + priority"/>
	<subdialog name="update_log_2" namelist="session_log_note_2 session.id session.telephone.dnis session.telephone.ani" method="post" src="http://www..."/>

	<record name="vmsg" beep="true" maxtime="180s" finalsilence="4000ms" dtmfterm="true" type="audio/x-wav">
		...
	</record>
	
</form>

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

Watch placement of IVR script for proper execution

Post by support »

Hi,

Yes, that is correct. The reason why your line of IVR code gets executed immediately is because of the way it is nested at the form level in your IVR script. You should place this line of IVR code in between the IVR tags, <block> and </block> to make sure that it is executed properly.

Regards,
Plum Support

Post Reply