当前位置:Gxlcms > PHP教程 > 搞了个简单群呼系统(asterisk+PHP)

搞了个简单群呼系统(asterisk+PHP)

时间:2021-07-01 10:21:17 帮助过:10人阅读

弄了个简单群呼系统(asterisk+PHP)

先说下从 excel 中导入号码到数据库中去,然后从数据库中读取这些号码生成呼叫文件,进行呼叫即可

?

?? ? ? ? ? ? ? ? ? ? ? ? ? ? ???? ??


?

?? 源码如下:(注:操作excel的读取文件就没写上来)

setOutputEncoding('utf-8');
		
		$conn= mysql_connect('localhost','root','888888') or die("数据库连接失败");
		mysql_query("set names 'utf-8'");//设置编码
输出 mysql_select_db('asterisk'); //选择数据库 $data->read('xls/tel.xls'); for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) { $sql = "INSERT INTO tel VALUES(null,'".$data->sheets[0]['cells'][$i][1]."',0)"; $query=mysql_query($sql); if($query) { } } }else { echo ""; } } //.................................................................................................................end //........从数据库中读取号码生成一个一个的.call呼叫文件............................................................................ if(isset($_POST['liji_tel'])) //立即呼叫。。这里还得完成流程呼叫完毕后。删除呼叫的号码 { $con= mysql_connect('localhost','root','888888') or die("数据库连接失败"); mysql_query("set names 'utf-8'");//设置编码输出 mysql_select_db('asterisk'); //选择数据 $result=mysql_query("select * from tel where s_id=0"); while($rows=mysql_fetch_row($result)) { $filename="$rows[1].call"; fopen($filename,"w+"); $somecontent_8001="channel: SIP/$rows[1]"."/n"."callerid: "."/n"."MaxRetries: 2"."/n"."Context: default"."/n"."RetryTime: 10"."/n"."WaitTime: 10"."/n"."Extension: _x."."/n"."setvar: id=$rows[0]"."/n"; if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { exit;} if (fwrite($handle, $somecontent_8001)=== FALSE) {exit;}fclose($handle); $kk="mv ".$filename." /var/spool/asterisk/outgoing/"; system($kk,$restult);}} echo ""; } //..............end ............................................................................................................ ?> 电话群呼(text): ?

人气教程排行