Skip to content

Instantly share code, notes, and snippets.

@LTGIV
Last active April 6, 2022 03:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LTGIV/959d21115f26e2af31bb to your computer and use it in GitHub Desktop.
Save LTGIV/959d21115f26e2af31bb to your computer and use it in GitHub Desktop.
Twilio SIP Voice Receiver => Asterisk PBX
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
/**
* Twilio SIP Voice Receiver => Asterisk PBX (also works on FreePBX's Inbound Routes)
* (Constructive suggestions for improvement are certainly welcomed.)
*
* Based on dealing with Jonathan Gottfried's blog entry on Twilio re: Twilio => SIP => Asterisk:
* https://www.twilio.com/blog/2013/03/build-a-twilio-hard-phone-with-sip-from-twilio-raspberry-pi-asterisk-freepbx-and-the-obihai-obi100.html
*
* Point Twilio Voice Request URL to http://YOUR-SERVER.COM/path/call.php/###-###-####
*
* -Louis T. Getterman IV
* https://twitter.com/LTGIV
* https://github.com/LTGIV
*/
$reqNum = substr($_ENV["PATH_INFO"], 1);
$reqNum = str_replace("-", "", $reqNum);
?>
<Response>
<Dial>
<Sip>
<Uri username="twilio1" password="drawtheowl"><?php echo($reqNum);?>@YOUR-SIP-SERVER.COM</Uri>
<Uri username="twilio2" password="drawtheowl"><?php echo($reqNum);?>@YOUR-SIP-SERVER.COM</Uri>
<Uri username="twilio3" password="drawtheowl"><?php echo($reqNum);?>@YOUR-SIP-SERVER.COM</Uri>
</Sip>
</Dial>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment