Initial commit with simple call example
This commit is contained in:
commit
09191ac270
5 changed files with 45 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
vendor/*
|
||||||
|
composer.lock
|
||||||
|
conf/*.yaml
|
||||||
|
files/*.mp3
|
||||||
|
files/*.xml
|
22
caller.php
Normal file
22
caller.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
require 'vendor/autoload.php';
|
||||||
|
require 'vendor/twilio/sdk/Services/Twilio.php';
|
||||||
|
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
$settings = Yaml::parse('conf/settings.yaml');
|
||||||
|
|
||||||
|
$client = new Services_Twilio(
|
||||||
|
$settings['twilio']['sid'],
|
||||||
|
$settings['twilio']['token']
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$call = $client->account->calls->create(
|
||||||
|
$settings['application']['from'],
|
||||||
|
$settings['application']['to'],
|
||||||
|
$settings['application']['xml']
|
||||||
|
);
|
||||||
|
} catch(Exception $e) {
|
||||||
|
echo 'Error: ' . $e->getMessage();
|
||||||
|
}
|
6
composer.json
Normal file
6
composer.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"twilio/sdk": "3.10.*",
|
||||||
|
"symfony/yaml": "2.1.*"
|
||||||
|
}
|
||||||
|
}
|
9
conf/settings.yaml.sample
Normal file
9
conf/settings.yaml.sample
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
twilio:
|
||||||
|
sid: TWILIOKEY
|
||||||
|
token: SECRETTOKEN
|
||||||
|
|
||||||
|
application:
|
||||||
|
mp3: http://www.domain.com/song-caller/file.xml
|
||||||
|
to: 15555555555
|
||||||
|
from: 15555555555
|
||||||
|
time: 1800
|
3
files/sample.xml.sample
Normal file
3
files/sample.xml.sample
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<Response>
|
||||||
|
<Play>http://www.atomaka.com/song-caller/golden-girls.mp3</Play>
|
||||||
|
</Response>
|
Loading…
Reference in a new issue