Created
May 6, 2010 12:29
-
-
Save mheadd/392074 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
} | |
} | |
] | |
} | |
* | |
*/ | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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