Page 1 of 1

assistance connecting to an .asp document

Posted: Fri Aug 03, 2007 1:45 pm
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

IVR code assistance for connecting to an .asp document

Posted: Fri Aug 03, 2007 3:12 pm
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

getting close...

Posted: Fri Aug 03, 2007 3:36 pm
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

update IVR code

Posted: Fri Aug 03, 2007 3:58 pm
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

Posted: Fri Aug 03, 2007 4:27 pm
by bmceachen
Thank you very much for your help. It works great!