Ticket #2497 (closed Patches: fixed)

Opened 1 year ago

Last modified 5 months ago

Patch to disable events in phpagi-asmanager

Reported by: pnlarsson Assigned to: p_lindheimer
Priority: minor Milestone: 2.5
Component: Core Version: SVN-HEAD
Keywords: Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

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.

Change History

07/01/08 15:45:12 changed by lazytt

pnlarsson: ping

07/01/08 17:00:37 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need Feedback.

pnlarrson,

ping - where are you filling up with events in which log? I would like to check my config to see if I'm getting those or if I have done something to mask the issue. This sounds like a good idea - I does it effect anything else, just the session that opens the connection? Let me know - this is maybe related to other things I've seen like webmeetme blasting events into logs - that could also be fixed??? thanks in advance.

07/02/08 14:48:23 changed by pnlarsson

It was a while ago, so i can't realy recall which log, but i think it was syslog or daemon.log (debian etch).

When you turn off events it will only affect that connection - so it's harmless - we don't listen to events only issuing commands and reading the results.

07/02/08 15:16:22 changed by p_lindheimer

sounds good - do you want to go ahead and change that on trunk then?

07/05/08 04:02:53 changed by pnlarsson

  • status changed from new to closed.
  • version changed from 2.3.1 to SVN-HEAD.
  • resolution set to fixed.

Committed to trunk in r5912

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads