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;
?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值