Twilio SIP Registration call international
Using an SIP IP Phone With Twilio
https://ertw.com/blog/2013/11/05/using-an-ip-phone-with-twilio/I found Sean Walberg’s blog show how to connect SIP Phone to Twilio, I test it work for me.
But the Voice URL app only work for local call not international, I modify and add international dialing.
<?php
$called = preg_replace(
array('/sip:011?(.*?)@.*/', '/sip:1?(.*?)@.*/'),
array('{$1}', '{$1}'),
$_POST['Called']);
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
ob_start();
var_dump($called);
var_dump($_POST);
$contents = ob_get_contents();
ob_end_clean();
error_log($contents, 3, "/tmp/twilio.txt");
?>
<Response>
<Dial timeout="10" record="false" callerId="YOURTWILIONUMBER"><?= $called ?></Dial>
</Response>
Comments
Post a Comment