Made a simple group call system (asterisk+php)
In the first place, import numbers from Excel into the database, and then read the numbers from the database to generate call files and make calls.
?
?? ? ? ? ? ? ? ? ? ? ? ? ? ? ???? ??
?
?? The source code is as follows: (note: The operation of Excel read file is not written up)
Setoutputencoding (' Utf-8 '); $conn = mysql_connect (' localhost ', ' root ', ' 888888 ') or Die ("database connection Failed"); mysql_query ("Set Names ' Utf-8 ');//Set the encoded output mysql_select_db (' asterisk '); Select Database $data->read (' Xls/tel.xls '); for ($i = 2; $i <= $data->sheets[0][' numrows '); $i + +) {$sql = "INSERT into tel VALUES (null, '". $data-& gt;sheets[0][' cells '] [$i][1]. "', 0"; $query =mysql_query ($sql); if ($query) {}}}else{echo "
";} } //................................................................................................................. end//..... Reading a number from a database generates a. Call to a file .................... ....... ..... ................. ......... if (Isset ( $_post[' Liji_tel '))//Call now. You have to complete the process call here. Delete the number of the call {$con = mysql_connect (' localhost ', ' root ', ' 888888 ') or Die ("database connection Failed"); mysql_query ("Set names ' Utf-8 '");// Set the encoded output mysql_select_db (' asterisk '); Select the data $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 ..... ..... ..... ..... ....... .................. ..... ..... ..... ..... ..... .............. .......... ...........? >
Call Group Call (text):
?