-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Lorne Gaetz edited this page Jan 15, 2014
·
3 revisions
Welcome to the php-ajam wiki!
<?php
require_once('Ajam.php');
// Configuration Options, edit to suit environment:
$config['urlraw'] = 'http://<server_ip>:8088/asterisk/rawman'; // use pbx ip, port number, http prefix, full URL to rawman
$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>";
}