Documentation is available at voice_command.php
- <?php
- /**
- * Command menu of the voice application
- *
- * Executes a command selected by the user and confirms it if successful
- * @package Phone2Dev
- * @author Stanislav Miroshnikov
- */
- // start the session
- session_start();
- print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
- /**
- * Requires a custom error handler
- */
- require_once("voice_error.php");
- //trigger_error('This is an information log message.', E_USER_NOTICE);
- //NOTE: default values are for debuging purposes only
- /*
- if(!isset($_SESSION['intUserId'])) {
- $_SESSION['intUserId'] = 1;
- }
- if(!isset($_SESSION['intMainMenuId'])) {
- $_SESSION['intMainMenuId'] = 1;
- }
- if(!isset($_GET['commandId'])) {
- $_GET['commandId'] = 1;
- }
- if(!isset($_GET['menuId'])) {
- $_GET['menuId'] = 1;
- }
- if(!isset($_GET['deviceId'])) {
- $_GET['deviceId'] = 1;
- }
- */
- /**
- * Requires PHP Voice library to generate the VoiceXML
- */
- require_once ("phpvoice/vxml.class.php");
- // check that the required parameters are set
- if(
- isset($_SESSION['intUserId']) &&
- isset($_SESSION['intMainMenuId']) &&
- isset($_GET['commandId']) &&
- isset($_GET['menuId']) &&
- isset($_GET['deviceId'])) {
- /**
- * Requires the Phone2Dev class to access the database
- */
- require_once ("phone2dev.php");
- $objP2D =& new Phone2Dev();
- // connect to the database
- $objP2D->dbConnect();
- // activate the command
- $intStatus = $objP2D->executeCommand($_GET['commandId'],
- $_GET['deviceId'],
- $_SESSION['intUserId']);
- $app =& new gonx_vxml();
- $app->start_vxml("", "", "", "", "", "2.0"); {
- // catch the disconnect event
- $app->start_catch("connection.disconnect"); {
- $app->start_exit_c();
- }$app->end_catch();
- // show the menu
- $app->start_menu("command_menu"); {
- $app->start_prompt(); {
- if($intStatus == 200) {
- $app->write("Command was send successfully.");
- } else {
- $app->write("Command send failed with error code: ".$intStatus.".");
- }
- $app->write("Select one of the following menu choices");
- $app->start_enumerate_c();
- }$app->end_prompt();
- $app->start_choice("", "", "",
- "voice_menu.php?menuId="
- .$_SESSION['intMainMenuId']);{
- $app->write("Return to main menu.");
- }$app->end_choice();
- if($_GET['menuId'] != $_SESSION['intMainMenuId']) {
- // this command has a parent menu if it is not located
- // in the main menu
- $app->start_choice("", "", "",
- "voice_menu.php?menuId="
- .$_GET['menuId']);{
- $app->write("Return to previous menu.");
- }$app->end_choice();
- }
- }$app->end_menu();
- }$app->end_vxml();
- // generate the document
- $app->generate();
- // disconnect from the database
- $objP2D->dbDisconnect();
- } else {
- // user is not logged in correctly
- $app =& new gonx_vxml();
- $app->start_vxml("", "", "", "", "", "2.0"); {
- // catch the disconnect event
- $app->start_catch("connection.disconnect"); {
- $app->start_exit_c();
- }$app->end_catch();
- $app->start_form("login_failure",""); {
- $app->start_block(); {
- $app->start_prompt(); {
- $app->write("Error. Your session have expired or");
- $app->write("you have not logged in.");
- }$app->end_prompt();
- }$app->end_block();
- $app->start_exit_c();
- }$app->end_form();
- // end of the vxml document
- }$app->end_vxml();
- // generate the document
- $app->generate();
- }
- ?>
Documentation generated on Tue, 4 Jan 2005 13:48:10 -0500 by phpDocumentor 1.3.0RC3