if ($result->name == 'choice') {
    say("Great, you said " . $result->value);
}
// Digits work with speech or touch-tone input...
$result = prompt("Hello.  Please say or enter your 5 digit ZIP code", array("choices" => "[5 DIGITS]"));
if ($result->name == 'choice') {
    say("Great, you said " . $result->value);
}
// ask for 1 to 6 digit long an account ID
$result = prompt("Please enter your account ID followed by the pound key.", array("choices" => "[1-6 DIGITS]"));
if ($result->name == 'choice') {
    say("Great, you said " . $result->value);
}
// ask for a US phone number (7 digits without area code, 10 digits with)
$result = prompt("Please enter your 7 to 10 digit U.S. phone number", array("choices" => "[7-10 DIGITS]"));
if ($result->name == 'choice') {
    say("Great, you said " . $result->value);
}
// digit collection also supports all other prompt properties and event handlers
_log("\$***********************result name " . $result->name);
while ($result->name != 'hangup') {
    // collect 3 digits.  Reprompt up to 3 times.  Use a 7 second timeout...
    $result = prompt("Now please enter a number between 1 and 999", array("choices" => "[1-3 DIGITS]", "repeat" => 3, "timeout" => 7, "onBadChoice" => create_function('$event', 'say("I am sorry, I did not understand what you said.");'), "onTimeout" => create_function('$event', 'say("I am sorry.  I didn\'t hear anything.");')));
    _log("{$result} name " . $result->name);
    _log("number is " . $result->value);
    if ($result->name == 'choice') {
        say("Great, you said " . $result->value);
    }
}
hangup();
Example #2
0
function _moduleContent(&$smarty, $module_name)
{
    global $arrConf;
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    //user credentials
    global $arrCredentials;
    $dsn_agi_manager = getDNSAGIManager();
    $action = getAction();
    $content = "";
    switch ($action) {
        case "add":
            $content = form_Recordings($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrCredentials);
            break;
        case "record":
            $content = record($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $dsn_agi_manager, $arrCredentials);
            break;
        case "hangup":
            $content = hangup($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $dsn_agi_manager, $arrCredentials);
            break;
        case "save":
            $content = save_recording($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrCredentials);
            break;
        case "remove":
            $content = remove_recording($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrCredentials);
            break;
        case "check_call_status":
            $content = checkCallStatus("call_status", $smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $dsn_agi_manager, $arrCredentials);
            break;
        case "checkName":
            $content = check_name($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $dsn_agi_manager, $arrCredentials);
            break;
        case "download":
            $content = downloadFile($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $dsn_agi_manager, $arrCredentials);
            break;
        default:
            $content = reportRecording($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}
Example #3
0
if (!isset($_REQUEST['type'])) {
    $response = array('action' => 'error', 'message' => 'no action defined');
} else {
    $sAction = getParameter('type');
    switch ($sAction) {
        case 'logout':
            $agent = getParameter('agent');
            logout($agent);
            break;
        case 'login':
            $agent = getParameter('agent');
            login($agent);
            break;
        case 'hangup':
            $agent = getParameter('agent');
            hangup($agent);
            break;
        case 'spycall':
            $agent = getParameter('agent');
            $supervisor = getParameter('supervisor');
            if (getParameter('whisper') == 'true') {
                $whisper = true;
            } else {
                $whisper = false;
            }
            spycall($agent, $supervisor, $whisper);
            break;
        case 'transfer':
            $agent = getParameter('agent');
            $dest = '8';
            $dest .= getParameter('extension');
Example #4
0
 if ($eventname == "Leave") {
 } else {
     if ($eventname == "Hangup") {
         /*
         Event: Hangup
         Privilege: call,all
         Channel: SIP/phono4-ext.voxeolabs.net-00000090
         Uniqueid: 1346187286.175
         CallerIDNum: 79786527-9c2c-4384-a1a4-f409cfe39a08
         CallerIDName: <unknown>
         ConnectedLineNum: <unknown>
         ConnectedLineName: <unknown>
         Cause: 0
         Cause-txt: Unknown
         */
         hangup($channel, $uniqueid);
     } else {
         if ($eventname == "CoreShowChannelsComplete") {
         } else {
             if ($eventname == "CoreShowChannel") {
                 /*echo "====================\n";
                   echo "Unique ID: ".$uniqueid."\n";
                   echo "App Data: ".$application_data."\n";
                   echo "CID Num: ".$calleridnum."\n";
                   echo "CID Name: ".$calleridname."\n";
                   echo "Duration: ".$duration."\n";
                   echo "AcctCode: ".$accountcode."\n";
                   echo "Bridged Channel: ".$bridgedchannel."\n";
                   echo "Bridged Unique ID: ".$bridgeduniqueid."\n";
                   echo "Event List: ".$eventlist."\n";
                   echo "List Items: ".$listitems."\n";
function verifyPin($pin)
{
    global $myPin;
    global $pinAttempts;
    ++$pinAttempts;
    // we'll tell the caller they got the pin number wrong
    if ($pin != $myPin) {
        say("You did not enter the correct pin!");
        // if we reach 3 attempts, hang up on the caller
        if ($pinAttempts == 3) {
            say("Goodbye!");
            hangup();
            exit;
        }
        // keep prompting until the 3rd attempt
        promptPin();
    }
}