示例#1
0
    }
    $msg = urlencode("Thank you for purchasing {$PhoneNumber}");
    $app->redirect($app->getBaseUri() . '/home?msg=' . $msg);
    exit(0);
});
$app->route('/voice', function () use($app) {
    header("Content-type: text/xml");
    $fid = $_GET['id'];
    $from = preg_replace("/[^0-9]/", "", $_POST['From']);
    $pdo = Db::singleton();
    $sql = "SELECT * FROM numbers WHERE ID='{$fid}';";
    $res = $pdo->query($sql);
    $number = $res->fetch();
    $fromNumber = $number['number'];
    if ($user = get_user($number['user_id'])) {
        $_SESSION['uid'] = $user['ID'];
        $toNumber = $user['phone_number'];
        $name = $user['name'];
        $response = new Services_Twilio_Twiml();
        $response->dial($toNumber, array('timeout' => 5));
        $response->say("I'm sorry, {$name} is not available at this time. Please leave a message after the tone.");
        $response->record(array('transcribeCallback' => 'transcribe.php?uid=' . $user['ID'] . '&From=' . $from, 'transcribe' => 'true'));
        print $response;
        exit;
    }
});
$app->route('/transcribe', function () use($app) {
    header("Content-type: text/xml");
    $uid = $_GET['uid'];
    if ($user = get_user($uid)) {
        $filter = "!@#\$^&%*()+=-[]\\/{}|:<>?,.";
示例#2
0
        if (!empty($phsid)) {
            $sql = "INSERT INTO numbers (user_id,number,sid) VALUES('{$user['ID']}','{$PhoneNumber}','{$phsid}');";
            $pdo = Db::singleton();
            $pdo->exec($sql);
            $fid = $pdo->lastInsertId();
            $ret = editNumber($phsid, array("FriendlyName" => $PhoneNumber, "VoiceUrl" => $mysiteURL . "/voice?id=" . $fid, "VoiceMethod" => "POST"), $user['sid'], $user['token']);
        }
    } catch (Exception $e) {
        $err = urlencode("Error purchasing number: {$e->getMessage()}");
        $app->redirect($app->getBaseUri() . '/phone-number?msg=' . $err);
        exit(0);
    }
    $msg = urlencode("Thank you for purchasing {$PhoneNumber}");
    $app->redirect($app->getBaseUri() . '/home?msg=' . $msg);
    exit(0);
});
$app->route('/voice', function () use($app) {
});
$app->get('/transcribe', function () use($app) {
});
$app->get('/logout', function () use($app) {
    $app->store('user', 0);
    $app->redirect($app->getBaseUri() . '/login');
});
$app->get('/home', function () use($app) {
    $app->condition('signed_in');
});
$app->get('/', function () use($app) {
    $app->render('home');
});
$app->listen();
示例#3
0
    }
    $msg = urlencode("Thank you for purchasing {$PhoneNumber}");
    $app->redirect($app->getBaseUri() . '/home?msg=' . $msg);
    exit(0);
});
$app->route('/voice', function () use($app) {
    header("Content-type: text/xml");
    $fid = $_GET['id'];
    $from = preg_replace("/[^0-9]/", "", $_POST['From']);
    $pdo = Db::singleton();
    $sql = "SELECT * FROM numbers WHERE ID='{$fid}';";
    $res = $pdo->query($sql);
    $number = $res->fetch();
    $fromNumber = $number['number'];
    if ($user = get_user($number['user_id'])) {
        $_SESSION['uid'] = $user['ID'];
        $toNumber = $user['phone_number'];
        $name = $user['name'];
        $response = new Services_Twilio_Twiml();
        $response->dial($toNumber, array('timeout' => 5));
        $response->say("I'm sorry, {$name} is not available at this time. Please leave a message after the tone.");
        $response->record(array('transcribeCallback' => 'transcribe.php?uid=' . $user['ID'] . '&From=' . $from, 'transcribe' => 'true'));
        print $response;
        exit;
    }
});
$app->route('/transcribe', function () use($app) {
    header("Content-type: text/xml");
    $uid = $_GET['uid'];
    if ($user = get_user($uid)) {
        $filter = "!@#\$^&%*()+=-[]\\/{}|:<>?,.";