Last active
September 23, 2015 01:23
-
-
Save twilioforkwc/2f223556da0cee85bbf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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