Skip to content

Instantly share code, notes, and snippets.

@RobSpectre
Created September 22, 2011 20:46
Show Gist options
  • Save RobSpectre/1235996 to your computer and use it in GitHub Desktop.
Save RobSpectre/1235996 to your computer and use it in GitHub Desktop.
SMS Notification to Conference
<?php
// This is the Voice Request URL to start the conference.
require_once('path/to/Services/Twilio.php');
$ACCOUNT_SID = 'ACxxxxxxxxxxxxxxxxxxxx';
$AUTH_TOKEN = 'yyyyyyyyyyyyyyyyyyyyyyy';
$CALLER_ID = '+1aaabbbcccc';
$user_to_request_conference_attendance = '+1xxxyyyzzzz';
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN);
$msg = $client->account->sms_messages->create(
$CALLER_ID,
$user_to_request_conference_attendance,
'Would you like to join the conference? Reply yes or no.'
);
header('Content-type: text/xml');
?>
<Response>
<Redirect>03_complete_conference.php</Redirect>
</Response>
<?php
// This is the Voice Request URL to start the conference.
require_once('path/to/Services/Twilio.php');
$ACCOUNT_SID = 'ACxxxxxxxxxxxxxxxxxxxx';
$AUTH_TOKEN = 'yyyyyyyyyyyyyyyyyyyyyyy';
$CALLER_ID = '+1aaabbbcccc';
$response = $_REQUEST['Body'];
if ($response == 'yes') {
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN);
$call = $client->account->calls->create(
$CALLER_ID,
$_REQUEST['From'],
"http://example.com/path/to/03_complete_conference.php"
);
}
?>
<?php
header('Content-type: text/xml');
?>
<Response>
<Dial>
<Conference>SMSNotificationToConference</Conference>
</Dial>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment