Hi,
I hate to see my logs get filled with events from phpagi-asmanager, and added a chance to disable events: (I don't have it in SVN though)
function connect($server=NULL, $username=NULL, $secret=NULL, $events='on')
{
// use config if not specified
if(is_null($server)) $server = $this->config['asmanager']['server'];
if(is_null($username)) $username = $this->config['asmanager']['username'];
if(is_null($secret)) $secret = $this->config['asmanager']['secret'];
// get port from server if specified
if(strpos($server, ':') !== false)
{
$c = explode(':', $server);
$this->server = $c[0];
$this->port = $c[1];
}
else
{
$this->server = $server;
$this->port = $this->config['asmanager']['port'];
}
// connect the socket
$errno = $errstr = NULL;
$this->socket = @fsockopen($this->server, $this->port, $errno, $errstr);
if($this->socket == false)
{
$this->log("Unable to connect to manager {$this->server}:{$this->port} ($errno): $errstr");
return false;
}
// read the header
$str = fgets($this->socket);
if($str == false)
{
// a problem.
$this->log("Asterisk Manager header not received.");
return false;
}
else
{
// note: don't $this->log($str) until someone looks to see why it mangles the logging
}
// login
$res = $this->send_request('login', array('Username'=>$username, 'Secret'=>$secret, 'Events'=>$events));
if($res['Response'] != 'Success')
{
$this->log("Failed to login.");
$this->disconnect();
return false;
}
return true;
}
The thought is to add this and then modify the calls to include the , 'off'); so that we tell asterisk to not send us any events.