예제 #1
0
<?php

// Download the library and copy into the folder containing this file.
require 'twilio-php/Services/Twilio.php';
$response = new Services_Twilio_Twiml();
$response->enqueue(array(workflowSid => 'WW0123456789abcdef0123456789abcdef'));
print $response;
?>

<!-- alternatively -->

<?php 
$workflowSid = "WW0123456789abcdef0123456789abcdef";
header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
	<Enqueue workflowSid="<?php 
echo $workflowSid;
?>
"/>
</Response>
예제 #2
0
<?php

// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/twilio-php/Services/Twilio.php';
// Loads the library
$response = new Services_Twilio_Twiml();
$response->enqueue('Queue Demo');
print $response;
예제 #3
0
<?php

// Download the library and copy into the folder containing this file.
require 'twilio-php/Services/Twilio.php';
$response = new Services_Twilio_Twiml();
$response->enqueue(array(workflowSid => 'WW0123456789abcdef0123456789abcdef'))->task("{'account_number':'12345abcdef'}");
print $response;
?>

<!-- alternatively -->

<?php 
$workflowSid = "WW0123456789abcdef0123456789abcdef";
header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
	<Enqueue workflowSid="<?php 
echo $workflowSid;
?>
">
		<Task>{"account_number": "12345abcdef"}</Task>
	</Enqueue>
</Response>
예제 #4
0
<?php

// Download the library and copy into the folder containing this file.
require 'twilio-php/Services/Twilio.php';
$response = new Services_Twilio_Twiml();
$response->enqueue(array(workflowSid => 'WW0123456789abcdef0123456789abcdef', waitUrl => '/hold_music.php', action => '/post_bridge_survey.php'))->task("{'account_number':'12345abcdef'}");
print $response;
?>

<!-- alternatively -->

<?php 
$workflowSid = "WW0123456789abcdef0123456789abcdef";
header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
	<Enqueue workflowSid="<?php 
echo $workflowSid;
?>
", waitUrl="/hold_music.php", action="/post_bridge_survey.php">
		<Task>{"account_number": "12345abcdef"}</Task>
	</Enqueue>
</Response>
예제 #5
0
<?php

include "config.php";
# Include Twilio PHP helper library.
require 'Services/Twilio.php';
# Tell Twilio to expect some XML
header('Content-type: text/xml');
# Create response object.
$response = new Services_Twilio_Twiml();
$response->enqueue($callqueue);
# Print TwiML
print $response;
예제 #6
0
// EnqueueAction URL作成
$ea = new ActionUrl();
$enqueue_action_url = $ea->getUrl("exit_enqueue.php");
// POSTで電話入力(DTMF入力)値が送られてきているかどうかの判定。初回アクセス時はelseへ
// isset()は関数の返値に対しては使えないので、!== NULLで判定
// 入力値を表示には使わないので、デフォルトでフィルタするのみ。
if (filter_input(INPUT_POST, 'Digits') !== NULL) {
    $input = filter_input(INPUT_POST, 'Digits');
    // DTMF入力判定
    switch ($input) {
        case '1':
            // 1の場合はオペレータに接続
            $response->say('オペレータにおつなぎします。しばらくお待ちください。', array('language' => Conf::LANG));
            // Queueに入れる
            // 待ちが発生した場合は、waitUrl呼び出し
            $response->enqueue(Conf::QUEUE, array('waitUrl' => 'wait.php', 'action' => $enqueue_action_url, 'method' => Conf::METHOD));
            break;
        case '2':
            // 2の場合は情報を提供する
            // XMLファイル呼び出し
            $response->redirect('information.xml');
            break;
        default:
            // 1,2以外の場合は再入力
            $gather = $response->gather(array('numDigits' => 1, 'timeout' => '10', 'method' => 'POST'));
            $gather->say('再度入力をお願いします。' . 'お問い合わせは1を、' . '最新の製品情報をお聞きになりたい場合は2を押してください。', array('language' => Conf::LANG));
            // タイムアウトとなった場合はオペレータに接続
            $response->say('入力が確認できませんでした。オペレータにおつなぎします。しばらくお待ちください。', array('language' => Conf::LANG));
            $response->enqueue(Conf::QUEUE, array('waitUrl' => 'wait.php', 'action' => $enqueue_action_url, 'method' => Conf::METHOD));
            break;
    }
예제 #7
0
<?php

// Download the library and copy into the folder containing this file.
require 'twilio-php/Services/Twilio.php';
$response = new Services_Twilio_Twiml();
$response->enqueue(array(workflowSid => 'WW0123456789abcdef0123456789abcdef'))->task("{'account_number':'12345abcdef'}", array(priority => 5, timeout => 200));
print $response;
?>

<!-- alternatively -->

<?php 
$workflowSid = "WW0123456789abcdef0123456789abcdef";
header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
	<Enqueue workflowSid="<?php 
echo $workflowSid;
?>
">
		<Task priority="5", timeout="200">{"account_number": "12345abcdef"}</Task>
	</Enqueue>
</Response>