Skip to content

Instantly share code, notes, and snippets.

@twilioforkwc
Last active August 29, 2015 14:06
Show Gist options
  • Save twilioforkwc/c87e6be759db7d6e8176 to your computer and use it in GitHub Desktop.
Save twilioforkwc/c87e6be759db7d6e8176 to your computer and use it in GitHub Desktop.
call-ivr.php
<?php
require("../Services/Twilio.php");
$response = new Services_Twilio_Twiml();
$voicetext = "〇〇様からのお電話です、通話をするには1を、通話の拒否は2を押してください。";
$voicetext2 = "電話をお繋ぎします。少々お待ちください。";
$voicetext3 = "電話を切断します。";
if (empty($_POST["Digits"])) {
$gather = $response->gather(array('numDigits' => 1, 'timeout' => 30));
$gather->say($voicetext, array('language' => 'ja-jp'));
} elseif($_POST["Digits"] == "1") {
$response->say($voicetext2, array('language' => 'ja-jp'));
} elseif($_POST["Digits"] == "2") {
$response->say($voicetext3, array('language' => 'ja-jp'));
$response->hangup();
}
print $response;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment