| CallXML 3.0 Development Guide | Home | Frameset Home |
|
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">
<do label="pound">
<say>you pressed the pound key.</say>
</do>
</callxml>
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">
<do label="star">
<say>you pressed the star key.</tsay>
</do>
</callxml>
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">
<do>
<prompt value="helloworld"
choices="*,#"/>
<on event="choice:*">
<goto value="helloworld-star.xml"
submit="*"
method="get"/>
</on>
<on event="choice:#">
<goto value="helloworld-pound.xml"
submit="*"
method="get"/>
</on>
</do>
</callxml>
<goto> elements to link to our server-side scripting language, the changes are in bold below. For this tutorial we will be using PHP v4.0 so we will need to change the scipt to read:
<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="3.0">
<do>
<prompt value="helloworld"
choices="*,#"/>
<on event="choice:*">
<goto value="helloworld-handler.php?key=star" submit="*" method="get"/>
</on>
<on event="choice:#">
<goto value="helloworld-handler.php?key=pound" submit="*" method="get"/>
</on>
</do>
</callxml>
<?PHP
?> indicates the end of the block.
$s = $HTTP_GET_VARS["key"];
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ";
echo "<callxml version=\"3.0\"> ";
echo " <do label=\" $s \"> ";
if ($s == "star") {
echo " <say>you pressed the star key.</say> ";
} else {
echo " <say>you pressed the pound key.</say> ";
}
echo " </do> ";
echo "</callxml>";
?>
<?PHP
$s = $HTTP_GET_VARS["key"];
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ";
echo "<callxml version=\"3.0\"> ";
echo " <do label=\" $s \"> ";
if ($s == "star") {
echo " <say>you pressed the star key.</say> ";
} else {
echo " <say>you pressed the pound key.</say> ";
}
echo " </do> ";
echo "</callxml>";
?>
| ANNOTATIONS: EXISTING POSTS |
rschoo
|
|
| Your example is showing:
echo "<?xml version=/"1.0/" encoding=/"UTF-8/" ?> "; echo "<callxml version=/"3.0/"> "; Shouldn't this be: echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> "; echo "<callxml version=\"3.0\"> "; that is backslash instead of slash. When I changed this in my program (I copied your code) my program started working. cheers reinier |
|
RickG
|
|
| Hi Reinier,
You're right, they should be backslashes. I'll make sure the documentation is corrected. Thank you for pointing this out! -Rick G. |
|
ruan
|
|
| Hi,
I created this XML file: <?xml version="1.0" encoding="UTF-8" ?> <callxml version="3.0"> <do choices="Option1,Option2,Option3"> <say> Welcome to my menu. Please state your query now. You have 3 available options. </say> <wait value="10s"/> <on event="choice:Option1"> <goto value="http://my_url.com/menu-handler.php?key=option1" submit="*" method="get"/> </on> <on event="choice:Option2"> <goto value="http://my_url.com/menu-handler.php?key=option2" submit="*" method="get"/> </on> <on event="choice:Option3"> <say> now arriving at $session.lastchoice;</say> </on> </do> </callxml> http://my_url.com/menu-handler.php?key=option1 returns: <?xml version="1.0" encoding="UTF-8" ?> <callxml version="3.0"> <do label="option1"> <say>Welcome to option 1, the url for option 1 is http://some.url.com</say> </do> </callxml> If I choose option3 it works perfectly, but neither option1 nor option2 works - I just get disconnected. Any ideas? |
|
mikethompson
|
|
| Hi Ruan,
Without seeing application debugger logs, it's difficult for me to tell what's going wrong here. However, to make sure the choice 1 and 2 events are getting hit at all, I would throw in some log lines. For example: <on event="choice:Option1"> <log> **************** OPTION 1 HIT ****************** </log> <goto value="http://my_url.com/menu-handler.php?key=option1" submit="*" method="get"/> </on> <on event="choice:Option2"> <log> **************** OPTION 2 HIT ****************** </log> <goto value="http://my_url.com/menu-handler.php?key=option2" submit="*" method="get"/> </on> <on event="choice:Option3"> <log> **************** OPTION 3 HIT ****************** </log> <say> now arriving at $session.lastchoice;</say> </on> Based on the code snippet, I don't see a reason why option 1 and 2 aren't working. Of course, this is assuming you are using real URLs in your true version of the code. Best, Mike Thompson Voxeo Corporation |
| login |
|