Skip to content

Instantly share code, notes, and snippets.

View hunnycode's full-sized avatar

joohoun song hunnycode

View GitHub Profile
require 'rubygems'
require 'twilio-ruby'
# put your own credentials here
account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new account_sid, auth_token
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'
# put your own credentials here - from twilio.com/user/account
account_sid = '[account SID]'
auth_token = '[Auth Token]'
# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new account_sid, auth_token
<?php
// Download/Install the PHP helper library from twilio.com/docs/libraries.
// This line loads the library
require('Services/Twilio.php');
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "Twilio SID";
$token = "Twilio Auth Token";
$client = new Services_Twilio($sid, $token);
<?php
// Download/Install the PHP helper library from twilio.com/docs/libraries.
// This line loads the library
require('Services/Twilio.php');
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "Twilio account SID";
$token = "Twilio account Auth Token";
$client = new Services_Twilio($sid, $token);
<?php
// Download/Install the PHP helper library from twilio.com/docs/libraries.
// This line loads the library
require('Services/Twilio.php');
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "Twilio account SID";
$token = "Twilio account Auth Token";
$client = new Services_Twilio($sid, $token);
<?php
require("Services/Twilio.php");
$response = new Services_Twilio();
$to = $_POST["To"];
$from = $_POST["From"];
$callSid = $_POST["CallSid"];
$callStatus = $_POST["CallStatus"];
$voicetext = "受信元の電話番号は ".$from."です。発信元の電話番号は".$to."です。この通話のコールキーは ".$callSid."です。通話状態は ".$callStatus."です。Twilioはこのようにリアルタイムで履歴を取得することが可能です。";
$response->say($voicetext, array('language' => 'ja-jp'));
<?php
$numbers = array("<number to call 1>", "<number to call 2>", "<number to call n>");
 $number_index = isset($_REQUEST['number_index']) ? $_REQUEST['number_index'] : "0";
 $DialCallStatus = isset($_POST['CallStatus']) ? $_POST['CallStatus'] : "";
header("content-type: text/xml");
 // Check the status of the call and
 // that there is a valid number to call
 if($DialCallStatus!="completed" && $number_index<count($numbers)){
<?php
header("content-type: text/xml");
?>
<Response>
<?PHP if (empty($_POST["Digits"])): ?>
<Say language="ja-jp">1号機のサーバーから障害が発生しました。次の操作を選択してください。エスカレーション先に電話をするには1を、サーバーを再起動するには2を、仮想マシンを追加するには3を、押してください。</Say>
<Gather numDigits="1" timeout="30" />
<?PHP elseif ($_POST["Digits"] == "1"): ?>
<Dial callerId="+8150xxxxxxxx">+813xxxxxxxx</Dial>
<Gather numDigits="1" timeout="30" />
<?php
include '../Services/Twilio/Capability.php';
$accountSid = '<AccountSid>';
$authToken = '<AuthToken>';
$appSid = '<ApplicationSid>';
$clientName = '<Twilio Client Name>';
if (isset($_REQUEST['client'])) {
$clientName = $_REQUEST['client'];
<?php
header('Content-type: text/xml');
// put a phone number you've verified with Twilio to use as a caller ID number
$callerId = "<発信番号>";
// put your default Twilio Client name here, for when a phone number isn't given
$number = "jenny";
// get the phone number from the page request parameters, if given