Asterisk click to call

余生长醉 提交于 2019-11-28 06:36:53

问题


Maybe some of you may know how to achieve this. I want something like this:

  1. Click on link/button
  2. My phone rings, I pick it up
  3. Asterisk dials number for me
  4. Recipient phone rings

I'm using asterisk 1.2.

I tried with dial out. But only I can make is to call to one side.

Thanks in advance.


回答1:


You can use call files. Just read: Asterisk auto-dial out.

I have made simple CGI script that called via web server creates call file (remember to use temp directory) and then moves it to /var/spool/asterisk/outgoing and Asterisk do rest of the work. From user perspective it works as you described. Also remember to normalize phone numbers (on my web pages they can have spaces, hyphens etc, while in call file they must look as dialable numbers).




回答2:


You can see a call script I wrote in PHP that opens a fax file but it will be suitable for your needs. Take a look at the complete script here: http://www.csrdu.org/nauman/2010/10/18/web-fax-for-asterisk/

$faxHeader = $_POST["faxHeader"];
$localID = $_POST["localID"];
$email = $_POST["email"];
$dest = $_POST["dest"];

$outbound_route = "@outbound-allroutes";
$outboundfax_context = "outboundfax";

$callfile = "Channel: Local/$dest$outbound_route\n" .
   "MaxRetries: 1\n" .
   "RetryTime: 60\n" .
   "WaitTime: 60\n"  .
   "Archive: yes\n"  .
   "Context: $outboundfax_context \n"  .
   "Extension: s\n" .
   "Priority: 1\n" .
   "Set: FAXFILE=$input_file_tif\n" .
   "Set: FAXHEADER=$faxHeader\n" .
   "Set: TIMESTAMP=" . date("d/m/y : H:i:s",time()) . "\n" .
   "Set: DESTINATION=$dest\n".
   "Set: LOCALID=$localID\n" .
   "Set: EMAIL=$email\n";

// create the call file in /tmp
$callfilename = unique_name("/tmp", ".call");
$f = fopen($callfilename, "w");
fwrite($f, $callfile);
fclose($f);

// $asterisk_spool_folder is usually /var/spool/asterisk/outgoing
rename($callfilename, $asterisk_spool_folder .  "/" . substr($callfilename,4));

Do read up on the callfile page why we need to move the file instead of opening and writing to it directly in the asterisk spool folder.



来源:https://stackoverflow.com/questions/4194977/asterisk-click-to-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!