trixbox call php发起电话呼叫
调用方法:
asterisk 命令行 OK
originate sip/801 extension 802
originate sip/802 extension 9013816338277@default
good bye挂断
originate sip/802 extension 9013816338277@from-internal
OK
Asterisk Call Manager (AMI)呼叫可以
http://xxxx/voip/call.php?internalnum=802&outboundnum=9013816338277&context=from-internal
代码:
<?php
$extension = $_REQUEST['internalnum'];
$dialphonenumber = $_REQUEST['outboundnum'];
$context = $_REQUEST['context'];
$timeout = 10;
$asterisk_ip = "127.0.0.1";
$socket = fsockopen($asterisk_ip,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n");
fputs($socket, "Secret: amp111\r\n\r\n");
$wrets=fgets($socket,1280);
echo $wrets;
echo "<br/>";
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$extension\r\n" );
fputs($socket, "Exten: $dialphonenumber\r\n" );
fputs($socket, "Context: $context\r\n" ); //'other option is - default, from-internal very important to change to your outbound context
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n" );
fputs($socket, "CallerID: $extension\r\n\r\n" );
$wrets=fgets($socket,1280);
echo $wrets;
echo "<br/>";
echo $extension;
echo "<br/>";
echo $context;
echo "<br/>";
echo $dialphonenumber;
?>