Click2Call sample

To originate a call from Asterisk using an external application, such as CRM or whatsoever, the easy solution is to use AMI API in order to connect to Asterisk server and initiate the call.
Here is the simple example in which phpagi-asmanager is used along with JQuery in index.php file to pass the phone number to the main php file: “call_originate.php”.


Here is the call_originate.php:

connect("Asterisk server IP","ami_test","password"))
	$channel = "SIP/107"; // Any available channel
	$exten= "9".$clean_number; // any valid number that you can use to call
    $timeout= 3000; 
    $callerid= NULL; 
    $variable= NULL;
	$org = $astman->Originate($channel,$exten,$context,
                  $priority, $application, $data, $timeout, $callerid,
                  $variable, $account, $async, $actionid);

$astman -> disconnect();
exit( 0 );


You may also like