[英]Trouble getting Asterisk AMI click2call working
我已經為Chrome設置了一個基於Asterisk AMI的click2call擴展程序進行測試,但是當我發送號碼時它拒絕執行任何操作。
如果我將http://10.8.0.2/amiscript.php?phone=5555555555&exten=910
直接插入瀏覽器,我會得到Please enter a number to dial.
馬上回來。 似乎無法正確解釋數字。
鏈接到擴展程序: http : //bitree.ru/click2call4chrome_en.html
顯然,我使用的是PHP腳本示例。 基於此,我得到了一個錯誤,我認為我的Web服務器端一切都很好。 這是腳本:
<? if (!empty( $_REQUEST['phone']) && !empty( $_REQUEST['exten'] ) )
{
$num = $_REQUEST['phone'];
$ext = $_REQUEST['exten'];
$num = preg_replace( "/^\+7/", "8", $num );
$num = preg_replace( "/\D/", "", $num );
if ( ! empty( $num ) )
{
echo "Dialing $num\r\n";
$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: bitree\r\n");
fputs($socket, "Secret: bitree_secret\r\n\r\n");
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: Local/$ext@from-internal\r\n" );
fputs($socket, "Exten: $num\r\n" );
fputs($socket, "Context: from-internal\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n" );
fputs($socket, "WaitTime: 15\r\n" );
fputs($socket, "Callerid: $num\r\n\r\n" );
$wrets=fgets($socket,128);
echo $wrets;
}
else
{
echo "Unable to determine number from (" . $_REQUEST['phone'] . ")\r\n";
}
}
else
{?>Please enter a number to dial.
<?}?>
有什么建議么?
首先,在php中有超過1的AMI協議(完整)實現。
例如phpagi / phpami。
它已經穩定並且可以正常工作。
我也可以建議您進行變量輸出。
最簡單的方法是在您的php代碼開始處添加類似
print_r($_REQUEST);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.