Skip to content

Instantly share code, notes, and snippets.

@swalberg
Created June 21, 2014 14:19
Show Gist options
  • Save swalberg/c2950b8b6d679b07919b to your computer and use it in GitHub Desktop.
Save swalberg/c2950b8b6d679b07919b 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