phpxmlvoicexml

VoiceXML <submit> tag throwing a compilation error on php


Long time lurker, first time asker. This task seems relatively straightforward: create a VoiceXML doc that will trigger a script to change a text document to then run a game via verbal commands.

Relevant 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>

There are 5 conditions total below the initial one in if/else tags. When the phone # is called it asks you to give your command, it correctly goes to the conditional branch and then states that the tank.php document "can't be compiled" and disconnects. The trick is that the text file has indeed been changed by this verbal command and the php compiles/runs fine. When I take out the 'submit' tag, the document throws no errors. For whatever reason this 'compilation error' from the php seems to be causing the voiceXML form to prematurely disconnect.

Complete php document:

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

I've been working on this specific issue for 5 hours. Your suggestion could save my sanity.


Solution

  • Resolution!

    Voxeo (the service I'm using) offers a more thorough debugger than the vocal commands. Thank God.

    It threw me stuff like this (the exact content isn't important)

    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>
    

    What is important is that this error wasn't showing up in Postman or through PHP errors because as I expected, the php itself wasn't the problem but the way that the vxml interpreted it was. Throwing 'vxml' tags around the php script (keeping the .php ending) and the program is 100% happy and I spent almost 9 hours struggling to find a two line change.

    Hope this can help someone else, cheers!

    New 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>