Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created October 17, 2011 16:20
Show Gist options
  • Select an option

  • Save mheadd/1292993 to your computer and use it in GitHub Desktop.

Select an option

Save mheadd/1292993 to your computer and use it in GitHub Desktop.
say('Hello');
var result = ask('Begin entering a series of digits separated by the star key.', {choices: 'http://path-to/grammar.xml', terminator: '#', mode: 'dtmf', timeout: 5.0});
log('*** ' + result.value.replace(" ", "") + ' ***');
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
version="1.0" xml:lang="en-US" root="main">
<rule id="main" scope="public">
<item repeat="1-">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>0</item>
<item>*</item>
</one-of>
</item>
</rule>
</grammar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment