Skip to content
Lorne Gaetz edited this page Jan 15, 2014 · 3 revisions

Welcome to the php-ajam wiki!

Sample Usage:

<?php
require_once('Ajam.php');

// Configuration Options, edit to suit environment:
$config['urlraw'] = 'http://<server_ip>:8088/asterisk/rawman';  // use pbx ip, port number, prefix
$config['admin'] = 'admin';  // as defined in manager.conf
$config['secret'] = 'secret';  // as defined in manager.conf
$config['authtype'] = 'plaintext'; 
$config['cookiefile'] = null;
$config['debug'] = null;  // set to true for verbose debug output, to disable debug DON'T USE FALSE!

$ajam = new Ajam($config);
if ($ajam) {
	// ping connection and get response
	$ajam->doCommand('ping');
	$test = $ajam->getResult();
	echo $test['Response'];  // will echo 'Success' if command was successful

	// sample command to bridge local extension 100 with external number 555-1212
	$foo['Channel'] = "local/100@from-internal";
	$foo['Context'] = 'from-internal';
	$foo['Exten'] = '5551212';
	$foo['Priority'] = '1';
	$foo['Async'] = 'yes';
	$foo['Timeout'] = '30000';
	$foo['CALLERID'] = '"AJAM"<5556666>';
	$test = $ajam->doCommand('originate', $foo);
}

else {
	echo "ajam connection failed</p>";
}
Clone this wiki locally