このページは、Twilioのハンズオン参加者向けで作成しました。
■ Twilio公式ドキュメント
◎ Twilio公式ドキュメント
◎ TwiML
◎ REST API
◎ サンプルコード
◎ Helper ライブラリ
■ 新規アカウント登録(無料)
https://jp.twilio.com/try-twilio/kddi-web
・新規登録ガイドライン(ブログ)
http://twilio.kddi-web.com/blog/developper/entry000195.html
■ ハンズオンで使うコード
・テキストを音声へ:Say
・ドキュメント:https://jp.twilio.com/docs/api/twiml/say
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">テキストを音声に変換します。</Say>
</Response>
・録音:Record
・ドキュメント:https://jp.twilio.com/docs/api/twiml/record
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">録音を行います。メッセージを残してください。</Say>
<Record />
</Response>
・音声ファイルの再生:Play
・ドキュメント:https://jp.twilio.com/docs/api/twiml/play
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">音声ファイルを再生します。</Say>
<Play>{音声ファイルのURL}</Play>
</Response>
・通話処理の分岐:Gather
・ドキュメント:https://jp.twilio.com/docs/api/twiml/gather
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather timeout="10" finishOnKey="*">
<Say>電話機の数字ボタンを押してください。</Say>
</Gather>
</Response>
・PHPライブラリーから発信
<?php
require('../Services/Twilio.php');
$account_sid = "ACxxxxxxxxxxx";
$auth_token = "xxxxxxxxxxxx";
$client = new Services_Twilio($account_sid, $auth_token);
$call = $client->account->calls->create("+8150xxxxxxx", "+8180xxxxxxx", "http://xxxxxxx/say.xml", array("Method" => "GET"));
echo $call->sid;
■ コマンド
scp : scp -P 22 [filename] twilioapistudy@xxx.xxx.xxx.xxx:/var/www/html/twilio/xxxx/
例) scp -P 22 incomming.xml twilioapistudy@xxx.xxx.xxx.xxx:/var/www/html/twilio/xxxx/
mkdir(ディレクトリの生成) : mkdir [option] [ディレクトリ名]
rm(ディレクトリやファイルの削除) : rm [option] [ディレクトリもしくはファイル名]
[option] -d:ディレクトリ削除、-r,-R:ディレクトリ無いのファイルを含めて削除
■ TwilioJP-UG
https://twiliojp-ug.doorkeeper.jp/
■ Twilioのコミュニティ
◎ twitter : @twilioforkwc
◎ facebook page : https://facebook.com/TwilioforKWC
◎ facebook group: https://facebook.com/groups/twilioforkwc
◎ SlideShare : http://slideshare.net/twilioforkwc
◎ Doorkeeper:http://twiliomeetup.doorkeeper.jp
◎ GitHub:https://github.com/twilioforkwc
◎ YouTube:https://youtube.com/user/twilioforkwc