There are two components in DEV: the VoiceXML script and the PHP script.
The VXML script contains the text that the caller will hear. The PHP script handles all the backend processes and API calls. The PHP initiates when the VXML script gets to the <subdialog> tag.
The first prompt (lines 5-7) mirrors the prompt module in the Fuse app. In the following section (starting on line 12), you can see the counterpart to the record module. Here the name of the audio file is set to myrecording.
<?xml version="1.0"?><vxmlversion="2.1"> <form> <block> <prompt> The following is an example of prompting a caller to leave a recorded message, then sending that message to our real-time-transcription API, and finally have the system read back the transcription as TTS.
</prompt> <gotonext="#record"/> </block> </form> <formid="record"> <varname="callrecording"/> <recordname="myrecording"beep="true"> <prompt> Please leave a recorded message after the beep. When you are done recording, press the pound key. </prompt> <filled> <assignname="callrecording"expr="myrecording"/> </filled> </record> <subdialog name="transcription" src="subdialog.php" namelist="callrecording" method="post" enctype="multipart/form-data"/>
<block> We transcribed your message as, <valueexpr="transcription.message"/>. </block> </form></vxml>
The API call starts at the <subdialog> tag. Looking at the subdialog.php script, you can see that both the language and audio form data parameters get set in the $post = array section (starting on Line 10).
The $result section (starting on line 17) checks to make sure everything occurred as intended. If everything checks out, it provides the variable names for the VXML script, otherwise it logs an error.
Looking back at the VXML script (line 23), you can see that the app reads back the text of the transcription, indicated here by the variable transcription.message.