Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
require('Services/Twilio.php');
$number = "hoge";
// 画面から入力された電話番号の取得
if (isset($_REQUEST['To'])) {
$number = $_REQUEST['To'];
}
// 発信先が番号かClient名かを判別し、発信先を設定する。
if (preg_match("/^[\d\+\-\(\) ]+$/", $number)) {
$numberOrClient = "<Number>" . $number . "</Number>";
} elseif(stristr($number, "@")) {
$numberOrClient = "<Sip>" . $number . "</Sip>";
} else {
$numberOrClient = "<Client>" . $number . "</Client>";
}
?>
<Response>
<Say language="ja-jp">Twilio Clientから電話をかけます。</Say>
<Dial callerId="<?php echo $callerId ?>">
<?php echo $numberOrClient; ?>
</Dial>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.