VoiceXML<;提交>;标记在php上引发编译错误


VoiceXML <submit> tag throwing a compilation error on php

长期潜伏者,首次询问者。这个任务看起来相对简单:创建一个VoiceXML文档,该文档将触发一个脚本来更改文本文档,然后通过口头命令运行游戏。

相关VoiceXML:

<!--Encoding details-->
<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml"> 
<if cond="command =='t1 go'">
   <submit next="tank.php?command=t1%20go" method="get" namelist="command"/>
</if>

if/else标签中的初始条件下总共有5个条件。当电话#被调用时,它会要求您给出命令,它会正确地转到条件分支,然后声明tank.php文档"无法编译"并断开连接。的诀窍是,这个口头命令确实更改了文本文件,php编译/运行良好。当我去掉"submit"标记时,文档不会抛出任何错误。无论出于何种原因,php的"编译错误"似乎导致voiceXML表单过早断开连接。

完整的php文档:

<?php
    $myfile = fopen("gismoCommand.txt", "w") or die("Unable to open file!");
    $command = $_GET["command"];
    fwrite($myfile, $command);
    fclose($myfile);
?>

我已经为这个具体问题工作了5个小时。你的建议可以挽救我的理智。

分辨率!

Voxeo(我正在使用的服务)提供了一个比语音命令更彻底的调试器。感谢上帝。

它向我扔了这样的东西(确切的内容并不重要)

TTS: Sorry, that content has an internal error.
RTSP MESSAGE(o): ANNOUNCE rtsp://localhost:9974/synthesizer/ RTSP/1.0 Cseq: 11 Session: b5bdeff3d79236676847995d294d3445-9468 Content-Type: application/mrcp Content-Length: 649 SPEAK 946796007 MRCP/1.0 Kill-On-Barge-In: true Voice-Name: Allison-EnglishUS Speech-Language: en-us Vendor-Specific-Parameters: Voxeo-Resource="en-us.TTS.fc808afe12384bcb90415baee30fc0d7.Staging-Loquendo;plugin=vxttsloq7;speechLanguage=en-us;voiceName=Allison-EnglishUS;type=loquendo";Voxeo-Playback-Mode=VXML;Voxeo-Community-ID=f25af74e6f994e15ae7214ca83a2fcd9;Voxeo-Virtual-Platform=Staging-Loquendo;Voxeo-Site-ID=fc808afe12384bcb90415baee30fc0d7 Content-Type: application/synthesis+ssml Content-Length: 129 <?xml version="1.0" encoding="UTF-8"?> <speak version="1.0" xml:lang="en-us"> Sorry, that content has an internal error. </speak>

重要的是这个错误没有出现在Postman中或通过PHP错误出现,因为正如我所料,PHP本身不是问题,而是vxml解释它的方式。在php脚本周围添加"vxml"标签(保持.php的结尾),程序100%满意,我花了将近9个小时努力寻找两行的更改。

希望这能帮助其他人,干杯!

新PHP:

<vxml version="2.0">
<?php
    $myfile = fopen("gismoCommand.txt", "w") or die("Unable to open file!");
    $command = $_GET["command"];
    fwrite($myfile, $command);
    fclose($myfile);
?>
</vxml>

"submit"是对有效VoiceXML文档的请求;请参阅官方规范。通过在文档周围放置"vxml"标签,您创建了一个足够合法的VoiceXML脚本,解释器可以读取和解释该脚本。

就我个人而言,对于这种情况,我会使用VoiceXML2.1中提供的Voxeo支持的"data"标记。返回一个最小的XML文档;忽略它;使用一个漂亮、干净、定义良好的出口继续处理VoiceXML。