lfx
lfx

Reputation: 1391

Asterisk click to call

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.

Upvotes: 1

Views: 7962

Answers (2)

recluze
recluze

Reputation: 1915

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.

Upvotes: 1

Michał Niklas
Michał Niklas

Reputation: 54322

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).

Upvotes: 4

Related Questions