Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created December 5, 2009 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mheadd/249885 to your computer and use it in GitHub Desktop.
Save mheadd/249885 to your computer and use it in GitHub Desktop.
<?php
include('class.sniffer.php');
$user_agent = $_SERVER['HTTP_USER_AGENT'];
try {
$sniffy = new sniffer($user_agent);
$channel_type = $sniffy->getChannelType();
}
catch (badSnifferException $ex) {
die($ex->getMessage());
}
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<vxml version="2.1">
<form id="F_1">
<catch event="noinput">
<if cond="channelType == 'sms'">
<log>*** Do not reprompt if SMS. ***</log>
<else/>
<reprompt/>
</if>
</catch>
<catch event="noinput" count="3">
<prompt cond="channelType != 'sms'">
Sorry you are having trouble. Please try your call again later. Goodbye.
</prompt>
<prompt cond="channelType == 'sms'">
No response received. Goodbye.
</prompt>
<exit/>
</catch>
<var name="channelType" expr="'<?php echo $channel_type; ?>'"/>
<field name="zip" type="digits?length=5">
<prompt>Enter your zip code.</prompt>
</field>
<field name="confirm" type="boolean?y=1" cond="channelType != 'sms'">
<prompt>
You entered
<say-as interpret-as="number" format="digits">
<value expr="zip"/>
</say-as>.
Is this correct? Enter 1 for yes, 2 for no.
</prompt>
<filled>
<if cond="!confirm">
<prompt>Lets try again.</prompt>
<clear/>
</if>
</filled>
</field>
<block>
<prompt>
You entered
<say-as interpret-as="number" format="digits">
<value expr="zip"/>
</say-as>.
</prompt>
<exit/>
</block>
</form>
</vxml>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment