Skip to content

Instantly share code, notes, and snippets.

@mickstevens
Forked from swalberg/sip.php
Created July 10, 2014 17:53
Show Gist options
  • Save mickstevens/1689dfc18713da137f88 to your computer and use it in GitHub Desktop.
Save mickstevens/1689dfc18713da137f88 to your computer and use it in GitHub Desktop.
<?php
// From http://ertw.com/blog/2013/11/05/using-an-ip-phone-with-twilio/
// Connect an incoming call to your SIP phone through Twilio
$called = preg_replace('/sip:1?(.*?)@.*/', '{$1}', $_POST['Called']);
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Dial timeout="10" record="false" callerId="YOURTWILIONUMBER"><?= $called ?></Dial>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment