2021-02-23

实现回拨 AGI(PHP)

用agi实现电话回拨,技术很简单,只要知道就会用。

[capiin]
exten => 1234/016066666,1,Wait,1
exten => 1234/016066666,2,AGI,callback.php
exten => 1234/016066666,3,Hangup

callback.php

< ? p h p
ob_implicit_flush(true);
set_time_limit(0);
$err=fopen(“php://stderr”,”w”);
$in = fopen(“php://stdin”,”r”);
while (!feof($in)) {
$temp = str_replace(“/n”,””,fgets($in,4096));
$s = split(“:”,$temp);
$agi[str_replace(“agi_”,””,$s[0])] = trim($s[1]);
if (($temp == “”) || ($temp == “/n”)) {
break;
}
}
$cf = fopen(“/home/kapejod/pbx/var/spool/asterisk/outgoing/cb”.$agi[“callerid”],”w+”); fputs($cf,”Channel: CAPI/”.$agi[“extension”].”:”.$agi[“callerid”].”/n”);
fputs($cf,”Context: capidialtone/n”);
fputs($cf,”Extension: s/n”);
fputs($cf,”SetVar: CALLERIDNUM=”.$agi[“extension”].”/n”);
fputs($cf,”MaxRetries: 2/n”);
fputs($cf,”RetryTime: 10/n”);
fclose($cf);
fclose($in);
fclose($err);
? >

php中文网最新课程二维码

  • 相关标签:实现回拨 AGI(PHP)
  • 本文原创发布php中文网,转载请注明出处,感谢您的尊重!
  • https://www.php.cn/php-weizijiaocheng-266146.html

    发表回复

    Your email address will not be published. Required fields are marked *