A simple group call system (asterisk + PHP) is created. first, import numbers from excel to the database, and then read these numbers from the database to generate a call file, you can call ????????????????????????? Source code is as follows: (Note: The excel reading file is not written) & lt ;? Php * first needs to set the corresponding location in the server where the file is uploaded, and then create a simple group calling system (asterisk + PHP)
First, import the numbers from excel to the database, and then read the numbers from the database to generate a call file.
?
?? ? ? ? ? ? ? ? ? ? ? ? ? ? ???? ??
?
?? The source code is as follows: (Note: The excel reading file is not written)
SetOutputEncoding ('utf-8'); $ conn = mysql_connect ('localhost', 'root', '000000') or die ("database connection failed "); mysql_query ("set names 'utf-8'"); // sets the encoding 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-> sheets [0] ['cells '] [$ I] [1]. "', 0)"; $ query = mysql_query ($ SQL); if ($ query) {}} else {echo"
";}} //...................................... ........................................ ................................... End //........ read numbers from the database to generate one by one. call file ..................................... ....................................... if (isset ($ _ POST ['liji _ tel ']) // call now .. After completing the call process. Delete the call number {$ con = mysql_connect ('localhost', 'root', '123') or die ("database connection failed "); mysql_query ("set names 'utf-8'"); // sets the encoding output mysql_select_db ('asterisk '); // select 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 ....................................... ........................................ ........................?>
Text ):
?