Skip to content

Instantly share code, notes, and snippets.

View hunnycode's full-sized avatar

joohoun song hunnycode

View GitHub Profile
@hunnycode
hunnycode / twilioCall.php
Last active December 13, 2015 16:48
架電に必要な情報を設定。
<?php
require("Services/Twilio.php");
$tel_from = "[tel from number]"; // From a Twilio number in your account : CallerID
$tel_to = "[tel to number]"; // Call any number
$sid = "[set your SID]"; // Your Twilio account sid
$token = "[set your AUTH TOKEN]"; // Your Twilio auth token
$client = new Services_Twilio($sid, $token);
@hunnycode
hunnycode / call.xml
Last active December 13, 2015 16:48
TwiML
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">Twilioへようこそ。</Say>
</Response>
@hunnycode
hunnycode / README.md
Created February 14, 2013 04:21 — forked from TMcManus/README.md

The python port of libphonenumber is pretty complete, but is a little short on examples and sample code. Here are some simple examples for some common uses of this fantastic library.

@hunnycode
hunnycode / boundio_call.php
Last active December 15, 2015 05:39
boundio call
<?php
//***ユーザーシリアル、APIキーの設定
$serial = "[ユーザーシリアルID]";
$key = "[APIアクセスキー]";
//**架電情報の設定
$tel_to = "架電先電話番号";
$cast = "file(000001)%%gather(30,2)%%file(000002)";
//**架電用APIにPOST送信を行う(一例)
<?php
header("content-type: text/xml");
?>
<Response>
<?PHP if (empty($_POST["Digits"])): ?>
<Say language="ja-jp">Twilioへようこそ。電話の転送は1を、音声ファイルの再生は2を、終了は3を押してください。</Say>
<Gather numDigits="1" timeout="30" />
<?PHP elseif ($_POST["Digits"] == "1"): ?>
<Dial>[転送先電話番号]</Dial>
<Gather numDigits="1" timeout="30" />
@hunnycode
hunnycode / incomming-jp.xml
Last active June 8, 2023 07:01
Twilio動詞 <Say>に「language="ja-jp"」オプションを入れれば日本語のテキスト音声合成ができる。
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp">Twilioへようこそ!</Say>
</Response>
import webapp2
from twilio import twiml
from twilio.rest import TwilioRestClient
class SendSMS(webapp2.RequestHandler):
def get(self):
# replace with your credentials from: https://www.twilio.com/user/account
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
client = TwilioRestClient(account_sid, auth_token)
@hunnycode
hunnycode / process_poll.php
Last active December 16, 2015 14:29
Twilioを利用した投票システム。
<?php
require '../Services/Twilio.php';
// Connect to MySQL, and connect to the Database
mysql_connect('[ServerURL]', '[ID]', '[PWD]') or die(mysql_error());
mysql_select_db('[DB]') or die(mysql_error());
$pollDigits = $_REQUEST['Digits'];
$sql_telNo = mysql_query("SELECT * FROM poll");
@hunnycode
hunnycode / poll.php
Last active December 16, 2015 14:29
<?php
require '../Services/Twilio.php';
$response = new Services_Twilio_Twiml();
$gather = $response->gather(array(
'action' => '[your url]/process_poll.php',
'method' => 'GET',
'timeout' => '30',
'numDigits' => '1'
));
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/your account sid/Calls.xml' \
-d 'From=%2B8150xxxxxxxx' \
-d 'To=%2B8180xxxxxxxx' \
-d 'Url=http%3A%2F%2F<twiML URL>' \
-u <Account SID>:<Auth Token>