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

assistance connecting to an .asp document

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
bmceachen
Posts: 7
Joined: Mon Jul 30, 2007 3:43 pm

assistance connecting to an .asp document

Post by bmceachen »

I have a test developers account and I am encountering issues while trying to fetch a phone number from a remote .asp page. I would appreciate any assistance debugging this document.

This xml code is located at

http://69.64.172.152:1920/PlumVoice/default4.aspx

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<returnnumber>
<outboundnumber>
4808943105
</outboundnumber>
</returnnumber>
I am accessing that code with this vxml application:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//The Plum Group//Voice Markup Language 2.0//EN"
"http://vxml.plumgroup.com/vxml-221.dtd">
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">

<form id="get_number">
<block>
<data name="returnnumber" srcexpr="'http://69.64.172.152:1920/PlumVoice/default4.aspx'"/>
<assign name="document.returnnumber" expr="returnnumber.documentElement"/>
<goto next="#display_number"/>
</block>
</form>
<form id="display_number">
<script><![CDATA[
function GetRoutedNumber(nodata)
{
try {
return returnnumber.documentElement.getElementsByTagName("outboundnumber").item(0).firstChild.data;
}
catch(e)
{
// the value could not be retrieved, so return this instead
return nodata;
}
}
]]>
</script>
<block>
<var name="number" expr="GetRoutedNumber('unknown number')"/>
<prompt>
Testing <value expr="number"/>
</prompt>
</block>


</form>

</vxml>
When I run this application, the plum voice output is "testing unknown number"

Any help is welcome.

Thanks,
Ben
-Ben

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

IVR code assistance for connecting to an .asp document

Post by support »

Hi,

Looking over your IVR code, there are two issues. First, you are trying to reference "documentElement" twice in your IVR code.

The first reference of it is in your <assign> tag:

Code: Select all

<assign name="document.returnnumber" expr="returnnumber.documentElement"/> 
The second reference of it is in your "return" reference:

Code: Select all

return returnnumber.documentElement.getElementsByTagName("outboundnumber").item(0).firstChild.data; 
So, you have to remove the documentElement from either one of these since it won't work at the same time. The second issue of your IVR code is in your return statement. It should be:

Code: Select all

return returnnumber.documentElement.getElementsByTagName("outboundnumber").item(0).firstChild.toString(); 
Hope this clears things up.

Regards,
Plum Support
Last edited by support on Fri Feb 19, 2010 5:25 pm, edited 2 times in total.

bmceachen
Posts: 7
Joined: Mon Jul 30, 2007 3:43 pm

getting close...

Post by bmceachen »

I tried to make the changes you suggested but I am still getting "testing unknown number" as the response. I am hoping to hear, "testing 4808943105."

Here is what the revised code looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//The Plum Group//Voice Markup Language 2.0//EN"
"http://vxml.plumgroup.com/vxml-221.dtd">
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">

<form id="get_number">
<block>
<data name="returnnumber" srcexpr="'http://69.64.172.152:1920/PlumVoice/default4.aspx'"/>
<!--assign name="document.returnnumber" expr="returnnumber.documentElement"/-->
<goto next="#display_number"/>
</block>
</form>
<form id="display_number">
<script><![CDATA[
function GetRoutedNumber(nodata)
{
try {
return returnnumber.documentElement.getElementsByTagName("outboundnumber").item(0).firstChild.toString();
}
catch(e)
{
// the value could not be retrieved, so return this instead
return nodata;
}
}
]]>
</script>
<block>
<var name="number" expr="GetRoutedNumber('unknown number')"/>
<prompt>A
Testing <value expr="number"/>
</prompt>
</block>


</form>

</vxml>
Thanks for the support,

Ben
-Ben

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

update IVR code

Post by support »

Hi,

You should uncomment your line of IVR code with the <assign> tag since that allows your "returnnumber" to be a global variable. Also, from the earlier post, you should just remove the "documentElement" part from your return reference completely and this will clear up the double reference of "documentElement". Here is what the updated IVR code should look like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//The Plum Group//Voice Markup Language 2.0//EN"
"http://vxml.plumgroup.com/vxml-221.dtd">
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<form id="get_number">
	<block>
		<data name="returnnumber" srcexpr="'http://69.64.172.152:1920/PlumVoice/default4.aspx'"/>
		<assign name="document.returnnumber" expr="returnnumber.documentElement"/>
		<goto next="#display_number"/>
	</block>
</form>
<form id="display_number">
	<script><![CDATA[
		function GetRoutedNumber(nodata)
		{
			try {
				return returnnumber.getElementsByTagName("outboundnumber").item(0).firstChild.toString();
			}
			catch(e)
			{
				// the value could not be retrieved, so return this instead
				return nodata;
			}
		}
		]]>
	</script>
	<block>
		<var name="number" expr="GetRoutedNumber('unknown number')"/>
		<prompt>
			Testing <value expr="number"/>
		</prompt>
	</block>
</form>
</vxml>
Regards,
Plum Support
Last edited by support on Fri Feb 19, 2010 5:26 pm, edited 3 times in total.

bmceachen
Posts: 7
Joined: Mon Jul 30, 2007 3:43 pm

Post by bmceachen »

Thank you very much for your help. It works great!
-Ben

Post Reply