Skip to content

Instantly share code, notes, and snippets.

View twilioforkwc's full-sized avatar

Twilio for KDDI Web Communications twilioforkwc

View GitHub Profile
<?php
header("content-type: text/xml");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Say language="ja-jp">部署めいと名前を発話し、シャープを押してください</Say>
<Record maxLength="30" action="recorded.php" />
</Response>
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
require_once(dirname(__FILE__) . '/../lib/AmiDSRHTTP.class.php');
$buff = file_get_contents($_REQUEST['RecordingUrl']);
$amiVoice = new AmiDSRHTTP("http://Amivoice API URL/recognize","http://Amivoice API URL/Twilio/dialer/dialer.gram");
$result = $amiVoice->speechRecognition($buff);
if(!$result === false) {
# JSGF V1.0 UTF-8;
grammar dialer;
public <dialer> = ( <kanri> | <kaihatu> | <eigyou> ) [さん|くん|さま];
<kanri> = 管理本部 [の] ( 佐々木 | 佐藤 | 河野 ) ;
<kaihatu> = 開発本部 [の] (佐々木 | 田中 | 中村);
<eigyou> = 営業本部 [の] (西岡 | 山下 | 小林);
//addWord 管理本部 かんりほんぶ
//addWord 管理本部 かんりぶ
<?php
header("content-type: text/xml");
// 録音ファイルのURLを取得します。
$recording_url = $_POST['RecordingUrl'];
?>
<Response>
<Say language="ja-jp">録音ファイルを再生します。</Say>
<Play><?PHP echo $recording_url; ?></Play>
</Response>
<?php
require_once('../Services/Twilio.php'); // Loads the library
$sid = "ACxxxxxxxx";
$token = "yyyyyyyyyyyyyy";
$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->get("CAxxxxxxxxxxxx");
$call->update(array(
"Url" => "http://xxx.xxx.xxx.xxx/twiml-hangup.xml",
<?php
// Download the library and copy into the folder containing this file.
require('../../Services/Twilio.php');
$account_sid = "ACxxxxxxxxxxxxx"; // Your Twilio account sid
$auth_token = "yyyyyyyyyyyyyyy"; // Your Twilio auth token
$client = new Services_Twilio($account_sid, $auth_token);
$call = $client->account->calls->create(
<?php
header("content-type: text/xml");
// 録音ファイルのURLを取得します。
$recording_url = $_POST['RecordingUrl'];
?>
<Response>
<?PHP if ($recording_url != null): ?>
<Say language="ja-jp">録音ファイルを再生します。</Say>
<Play><?php echo $recording_url; ?></Play>
@twilioforkwc
twilioforkwc / twiml-enqueue.xml
Created September 10, 2014 08:33
twiml-enqueue.xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">少々お待ちください。</Say>
<Enqueue waitUrl="twiml-play.xml">supportRoom</Enqueue>
</Response>
@twilioforkwc
twilioforkwc / twiml-dial-queue.xml
Created September 10, 2014 08:35
twiml-dial-queue.xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">supportRoomにお繋ぎします。</Say>
<Dial>
<Queue>supportRoom</Queue>
</Dial>
</Response>
@twilioforkwc
twilioforkwc / twiml-call-update.php
Last active August 29, 2015 14:06
twiml-call-update.php
<?php
require_once('../Services/Twilio.php'); // Loads the library
$sid = "ACxxxxxxxxxxxxxxx"; // Twilio Account Sid
$token = "yyyyyyyyyyyyyyy"; // Twilio Auth Token
$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->get("CAxxxxxxxxxyyyyyyyyyy"); // Call Sid
$call->update(array(
"Url" => "http://xxx.xxx.xxx.xxx/twiml-enqueue.xml",