Skip to content

Instantly share code, notes, and snippets.

@twilioforkwc
Created September 22, 2015 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twilioforkwc/97eb7b432de3f8d980b4 to your computer and use it in GitHub Desktop.
Save twilioforkwc/97eb7b432de3f8d980b4 to your computer and use it in GitHub Desktop.
<?php
require("Services/Twilio.php");
$response = new Services_Twilio_Twiml();
$out_tel_to = "転送先電話番号";
$sound_url = "再生する音声ファイルのURL";
if (empty($_POST["Digits"])) {
$gather = $response->gather(array('numDigits' => 1, 'timeout' => 30));
$gather->say("Twilioへようこそ。電話の転送は1を音声ファイルの再生は2を電話の終了は3をおしてください。", array('language' => 'ja-jp'));
} elseif ($_POST["Digits"] == "1") {
$response->dial($out_tel_to);
$gather = $response->gather(array('numDigits' => 1, 'timeout' => 30));
} elseif ($_POST["Digits"] == "2") {
$response->play($sound_url, array("loop" => 1));
$gather = $response->gather(array('numDigits' => 1, 'timeout' => 30));
} elseif ($_POST["Digits"] == "3") {
$response->say("楽しいAPI Twilioのご利用ありがとうございました。", array('language' => 'ja-jp'));
}
print $response;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment