Last active
December 23, 2015 11:19
-
-
Save oostendo/6627956 to your computer and use it in GitHub Desktop.
sip forwarding with twilio
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
# sip.php | |
# | |
# quick and dirty outbound routing for sip phones with Twilio | |
# | |
# in your twilio sip tab | |
# set up your sip domain (DOMAIN.sip.twilio.com) | |
# register credentials for the username as the callback number with no spaces or +1 eg "3135551212" and set password | |
# validate the callback number | |
# set this script to the voice url | |
# set your sip client to authenticate with CALLBACKNUMBER/PASSWORD and host DOMAIN.sip.twilio.com | |
# enjoy extremely convenient outbound SIP calling | |
# | |
<? print '<?xml version="1.0" encoding="UTF-8"?>' ?> | |
<Response> | |
<?php | |
function sip2number($sip) { list($proto, $url, $port) = split(":", $sip); | |
list($number, $domain) = split("@", $url); return $number; | |
} | |
echo '<Dial callerId="+1' . sip2number($_REQUEST['From']) . '">' . sip2number($_REQUEST['To']) . '</Dial>'; | |
?> | |
</Response> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment