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

Variables from vxml to vxml

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
agfa
Posts: 40
Joined: Thu Jun 15, 2006 12:56 pm

Variables from vxml to vxml

Post by agfa »

Hi

I just wondered if it is possible to pass a variable from a vxml page to another vxml page. (My vxml page is getting a bit long, I would like to divide it into two but need one value to come across).
I have seen examples of using <submit... namelist../> but only when calling a script function.

If variable passing is possible using vxml, can somebody please explain the syntax to me.

(I realise you can use sub-dialogs to pass parameters, but in this case I am not going to return so a sub-dialog is not really appropriate.)

Thanks a lot.

Justin.

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

Root docs specified using IVR app attribute of VXML tag

Post by support »

Hello,

You can make use of root documents. Root documents are specified per VoiceXML script and are themselves a VoiceXML script. Any variables defined in the root document will be carried between all of your documents. Any assignments to those variables in a given IVR script are preserved so long as the next document transitioned to also includes the same root document.

Root documents are specified using the IVR application attribute of the VoiceXML tag. The following IVR example uses three VoiceXML files, one root document and two child documents that use the root document and assign and evaluate a root variable:

root.vxml

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
	<var name="foo"/>
</vxml>
page1.vxml

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0" application="root.vxml">
	<form>
		<block>
			<assign name="foo" expr="'bar'"/>
			<goto next="page2.vxml"/>
		</block>
	</form>
</vxml>
page2.vxml

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0" application="root.vxml">
	<form>
		<block>
			<prompt bargein="false">
				The value foo is set to <value expr="foo"/>
			</prompt>
		</block>
	</form>
</vxml>
If you transition to a page that does not use the same root document all variables stored in the root document will be lost.

Regards,
Plum Support
Last edited by support on Sat Feb 20, 2010 3:21 pm, edited 3 times in total.

agfa
Posts: 40
Joined: Thu Jun 15, 2006 12:56 pm

Post by agfa »

Thank you for the reply,

Can I just ask one more thing. Are those root document variables assigned and used by session or by application?

E.g. What happens in this situation, given a root variable 'happy'
1) call comes in, page1.vxml sets 'happy' to 0
2) call continues, page2.vxml sets 'happy' to 1
3) new call comes in, page1.vxml sets 'happy' to 0.

We now have two sessions. What is the value of 'happy' in each session?

Regards

Justin

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

no way to share info between IVR sessions except on app ser

Post by support »

Hello,

The root document is loaded per IVR session. So for each IVR call it will be fetched (at least from the cache) and reloaded as a new starting context. There is no way to share information between IVR sessions other than to do so on your IVR application server.

Regards,
Plum Support

Post Reply