Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow masking events on Login when opening the connection #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adaxi
Copy link

@adaxi adaxi commented Jan 25, 2018

I have an Asterisk instance that generates a great amount of events. The manager is configured to authorize all events:

read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate,message

My application connects using the Asterisk Management Interface (AMI) but at startup I don't want to be flooded by all events generated by Asterisk. I want to be able to select which events should be transmitted.

Using the Events command I can decide which events should be transmitted. Unfortunately from the moment I login until the moment I submit this command my application is flooded by events.

A non-documented feature of the login action allows us to set the event mask that we are interested in at Login.

This pull request allows you to pass an array of events:

var namiConfig = {
    host: process.argv[2],
    port: process.argv[3],
    username: process.argv[4],
    secret: process.argv[5],
    events: ['system', 'call']
};

var nami = new namiLib.Nami(namiConfig);

When the events option is omitted Nami does not set the event mask on the login action.

Similar to #13 but less intrusive.

@adaxi
Copy link
Author

adaxi commented Jul 16, 2019

Looks like the same was implemented in the PHP version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant