Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created May 6, 2010 12:29
Show Gist options
  • Save mheadd/392074 to your computer and use it in GitHub Desktop.
Save mheadd/392074 to your computer and use it in GitHub Desktop.
<?php
include('TropoClasses.php');
$tropo = new Tropo();
$tropo->ask("Please say your account number.", array("require" => true, "bargein" => true, "timeout" => 30, "name" => "foo", "choices" => "[5 DIGITS]"));
$tropo->renderJSON();
/**
* Rendered JSON
*
{
"tropo": [
{
"ask": {
"bargein": true,
"choices": {
"value": "[5 DIGITS]"
},
"name": "foo",
"say": {
"value": "Please say your account number."
},
"timeout": 30
}
}
]
}
*
*/
?>
<?php
// This is what the ask method in the main Tropo class will look like.
...
public function ask($prompt, Array $options) {
$say = new say($prompt);
$choices = isset($options["choices"]) ? new choices($options["choices"]) : null;
$ask = new ask($options["attempts"], $options["bargein"], $choices, $options["minConfidence"], $options["name"], $options["required"],
$say, $options["timeout"]);
$this->ask = sprintf($ask);
}
..
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment