function connectCall()
{
    global $sugar_config;
    ob_flush();
    $callRecipient = $_REQUEST["callRecipient"];
    $module_name = $_REQUEST['module_name'];
    $record_id = $_REQUEST['record_id'];
    $response = new Services_Twilio_Twiml();
    $response->pause(5);
    $response->say('Now connecting you.');
    $action = $sugar_config['site_url'] . "/index.php?entryPoint=twilio&action=callComplete&to_pdf=true&module_name={$module_name}&record_id={$record_id}";
    $dialAttributes = array('record' => 'true', 'action' => $action);
    $response->dial($callRecipient, $dialAttributes);
    print $response;
}
示例#2
0
<?php

/**
 * ミニコールセンターサービスでキューイング時にメッセージを送出するwait.php
 *
 * @author rutoru
 * @package Twilio-MiniCC
 * @GitHub  https://github.com/rutoru/Twilio-MiniCC
 */
// 設定クラス
require_once 'Conf.php';
// Twilio Helperライブラリ(index.phpと同じ場所にServicesフォルダが存在する前提)
require_once 'Services/Twilio.php';
// Twimlオブジェクト作成
$response = new Services_Twilio_Twiml();
// QueuePosition取得(数字のみにフィルタリング)
$waitnumber = filter_input(INPUT_POST, 'QueuePosition', FILTER_SANITIZE_NUMBER_INT);
// 待ち(短めの保留音を入れる予定)
$response->pause('3');
// キューイングメッセージ送出
$response->say("お待たせしております。現在、" . $waitnumber . "番目にお待ちです。", array('language' => Conf::LANG));
// 保留音送出
$response->play(Conf::MOH_LONG);
// TwiML作成
print $response;
 public function testPauseAddAttribute()
 {
     $r = new Services_Twilio_Twiml();
     $r->pause(array("foo" => "bar"));
     $expected = '<Response><Pause foo="bar"></Pause></Response>';
     $this->assertXmlStringEqualsXmlString($expected, $r);
 }
示例#4
0
<?php

require __DIR__ . '/../vendor/autoload.php';
if (isset($_POST['ParentCallSid'])) {
    session_id($_POST['ParentCallSid']);
}
session_start();
// What language should Twilio use?
$language = getenv('TWILIO_LANGUAGE');
$attributes = array('voice' => 'alice', 'language' => $language);
$twilio = new Services_Twilio_Twiml();
if (isset($_POST['Digits'])) {
    if ($_POST['Digits'] != '') {
        $_SESSION['engineer_accepted_call'] = true;
        $twilio->say("Connecting", $attributes);
    }
} else {
    $twilio->pause(array('length' => 2));
    $gather = $twilio->gather(array('timeout' => 10, 'numDigits' => 1));
    $gather->say("Press 1 to accept this call.", $attributes);
    $twilio->say("Goodbye.", $attributes);
    $twilio->hangup();
}
// send response
if (!headers_sent()) {
    header('Content-type: text/xml');
}
echo $twilio;