Implemented a simple group calling system (asterisk + PHP)

Source: Internet
Author: User
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 requires a simple group calling system (asterisk + PHP) for file upload)

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 ):
 
?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.