Beispiel #1
0
         $gather->addSay("Please enter the secret code now.", array("voice" => $config['voice']));
     } elseif (isset($config['roommates'][$index])) {
         // entered the digit for a valid roommate, forward the call
         $roommate = $config['roommates'][$index];
         $twiml->addSay("Connecting you to " . $roommate['name'], array("voice" => $config['voice']));
         $twiml->addDial($roommate['number']);
     }
     // not a valid input, send back to the menu
     $twiml->addRedirect($config['filename']);
     break;
 case "secret":
     // handle the secret code entry
     if ($config['secret'] && $_REQUEST['Digits'] == $config['secret']) {
         // secret code matches, buzz the caller in
         $twiml->addSay("Buzzing you in now.", array("voice" => $config['voice']));
         $twiml->addPlay("http://www.dialabc.com/i/cache/dtmfgen/wavpcm8.300/" . $config['gate_code'] . ".wav");
     }
     // either the feature is disabled or they didn't enter the proper code, send back to the menu
     $twiml->addRedirect($config['filename']);
     break;
 default:
     // provide the main menu
     $twiml->addPause(array("length" => "2"));
     $gather = $twiml->addGather(array("action" => $config['filename'] . "?page=gather", "numDigits" => "1", "method" => "POST"));
     $gather->addSay($config['greeting'], array("voice" => $config['voice']));
     // loop through each roommate for the menu
     foreach ($config['roommates'] as $num => $roommate) {
         $gather->addPause(array("length" => "1"));
         $gather->addSay("For " . $roommate['name'] . ", press " . ($num + 1) . ".", array("voice" => $config['voice']));
     }
     break;