How to stop massive amounts of unwanted AMI Event traffic

I was recently troubleshooting some network delays. In the course of inspecting things I did captures between my Asterisk host, and my host that interfaces with AMI.

From Asterisk to my other host there was massive amounts of unwanted Event traffic. Events such as “NewCallerid,” “Dial,” “Newstate,” “Newchannel,” “NewAccountCode,” etc, etc. After each “Event: Newstate” line there are several other lines containing various info. This accounted for a majority of the traffic between the two boxes. The host that interfaces with AMI only issues Actions that return “OK” or CoreShowChannels output.

Is turning these off a simple matter of issuing “ACTION: EVENTS\r\nEVENTMASK: OFF”? Neither I nor anyone else ever turned AMI Events on. Are these on by default?

Thanks.

Has anyone else seen this?

Please read item (6) of viewtopic.php?f=1&t=4208

then manager.conf.sample, which should be included with the sources.

Noted about bumping.

Also there’s nothing in manager.conf.sample to indicate a setting that would cause this. I only set enabled/port/bindaddr in general, and for my user I only user secre/deny/allow/read/write.

Would “Action: Events” cause this? Or is this turned on by default?

THanks.

Look at the settings for read.

Would read settings of system/call/agent/user/config cause AMI to generate and send this traffic? I was under the impression that these were just privilege settings, not something that would generate traffic to the client.

Enabling read for a category will give you all the events for that category, e.g. System will give you:

[code].2$ grep ‘manager_event(EVENT_FLAG_SYSTEM’ /.c //*.c
addons/chan_mobile.c: manager_event(EVENT_FLAG_SYSTEM, “MobileStatus”, “Status: Disconnect\r\nDevice: %s\r\n”, pvt->id);
addons/chan_mobile.c: manager_event(EVENT_FLAG_SYSTEM, “MobileStatus”, “Status: Disconnect\r\nDevice: %s\r\n”, pvt->id);
addons/chan_mobile.c: manager_event(EVENT_FLAG_SYSTEM, “MobileStatus”, “Status: Connect\r\nDevice: %s\r\n”, pvt->id);
addons/chan_ooh323.c: manager_event(EVENT_FLAG_SYSTEM,“ChannelUpdate”,"Channel: %s\r\nChanneltype: %s\r\n"
channels/chan_dahdi.c: manager_event(EVENT_FLAG_SYSTEM, “AlarmClear”, “Channel: %d\r\n”, p->channel);
channels/chan_dahdi.c: manager_event(EVENT_FLAG_SYSTEM, “SpanAlarmClear”, “Span: %d\r\n”, p->span);
channels/chan_dahdi.c: manager_event(EVENT_FLAG_SYSTEM, “Alarm”,
channels/chan_dahdi.c: manager_event(EVENT_FLAG_SYSTEM, “SpanAlarm”,
channels/chan_dahdi.c: manager_event(EVENT_FLAG_SYSTEM, “DNDState”,
channels/chan_gtalk.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelUpdate”, “Channel: %s\r\nChanneltype: %s\r\nGtalk-SID: %s\r\n”,
channels/chan_gtalk.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelUpdate”,
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelUpdate”,
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “Registry”, “ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n”, ast_inet_ntoa(sin->sin_addr));
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n”, peer->name);
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\nPort: %d\r\n”, p->name, ast_inet_ntoa(sin-

sin_addr), ntohs(sin->sin_port));
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unregistered\r\n”, p->name);
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Reachable\r\nTime: %d\r\n”, peer->name,
iaxs[fr->callno]->pingtime);
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Lagged\r\nTime: %d\r\n”, peer->name, ia
xs[fr->callno]->pingtime);
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “Registry”, “ChannelType: IAX2\r\nUsername: %s\r\nStatus: Rejected\r\nCause: %s\r\n”, iaxs[fr->callno]->reg->use
rname, ies.cause ? ies.cause : “”);
channels/chan_iax2.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n”, peer->name, peer->lastms);
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelUpdate”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “Registry”, “ChannelType: SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n”, r->username, r->hostname, regstate2str(r->regstate));
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n”, peer->name);
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\n”, peer->name, ast_sockaddr_stringify(&peer->addr));
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\n”, peer->name, ast_sockaddr_stringif
y(addr));
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelUpdate”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “Registry”, “ChannelType: SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n”, r->username, r->hostname, regstate2str(r->regstate));
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “Registry”, “ChannelType: SIP\r\nDomain: %s\r\nStatus: %s\r\n”, r->hostname, regstate2str(r->regstate));
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n”, peer->name, -1);
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelUpdate”,
channels/chan_sip.c: manager_event(EVENT_FLAG_SYSTEM, “ChannelReload”, “ChannelType: SIP\r\nReloadReason: %s\r\nRegistry_Count: %d\r\nPeer_Count: %d\r\n”, channelreloadreason2txt(reason), registry_count, pe
er_count);
channels/chan_skinny.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: Skinny\r\nPeer: Skinny/%s@%s\r\nPeerStatus: Registered\r\n”, l->name, d->name);
channels/chan_skinny.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: Skinny\r\nPeer: Skinny/%s@%s\r\nPeerStatus: Unregistered\r\n”, l->name, d->name);
channels/chan_skinny.c: manager_event(EVENT_FLAG_SYSTEM, “PeerStatus”, “ChannelType: Skinny\r\nPeer: Skinny/%s@%s\r\nPeerStatus: Unregistered\r\n”, l->name, d->name);
channels/sig_analog.c: manager_event(EVENT_FLAG_SYSTEM, “AlarmClear”,
channels/sig_analog.c: manager_event(EVENT_FLAG_SYSTEM, “AlarmClear”,
channels/sig_analog.c: manager_event(EVENT_FLAG_SYSTEM, “DNDState”,
main/asterisk.c: manager_event(EVENT_FLAG_SYSTEM, “Shutdown”, "Shutdown: %s\r\n"
main/asterisk.c: manager_event(EVENT_FLAG_SYSTEM, “FullyBooted”, “Status: Fully Booted\r\n”);
main/cdr.c: manager_event(EVENT_FLAG_SYSTEM, “Reload”, “Module: CDR\r\nMessage: CDR subsystem reload requested\r\n”);
main/dnsmgr.c: manager_event(EVENT_FLAG_SYSTEM, “Reload”, “Module: DNSmgr\r\nStatus: %s\r/nMessage: DNSmgr reload Requested\r\n”, enabled ? “Enabled” : “Disabled”);
main/enum.c: manager_event(EVENT_FLAG_SYSTEM, “Reload”, “Module: Enum\r\nStatus: Enabled\r\nMessage: ENUM reload Requested\r\n”);
main/loader.c: manager_event(EVENT_FLAG_SYSTEM, “ModuleLoadReport”, “ModuleLoadStatus: Done\r\nModuleSelection: %s\r\nModuleCount: %d\r\n”, preload_only ? “Preload” : “All”, modulecount);
main/logger.c: manager_event(EVENT_FLAG_SYSTEM, “LogChannel”, “Channel: %s\r\nEnabled: Yes\r\n”, f->filename);
main/logger.c: manager_event(EVENT_FLAG_SYSTEM, “LogChannel”, “Channel: %s\r\nEnabled: No\r\nReason: %d - %s\r\n”, chan->filename, errno, strerror(errno));
main/manager.c: manager_event(EVENT_FLAG_SYSTEM, “Reload”, “Module: Manager\r\nStatus: %s\r\nMessage: Manager reload Requested\r\n”, manager_enabled ? “Enabled” : “Disabled”);[/code]

and Call will give you

.2$ grep 'manager_event(.*EVENT_FLAG_CALL' */*.c */*/*.c apps/app_chanspy.c: ast_manager_event(chan, EVENT_FLAG_CALL, "ChanSpyStop", "SpyeeChannel: %s\r\n", name); apps/app_confbridge.c: manager_event(EVENT_FLAG_CALL, "ConfbridgeStart", "Conference: %s\r\n", conf_name); apps/app_confbridge.c: manager_event(EVENT_FLAG_CALL, "ConfbridgeEnd", "Conference: %s\r\n", conf_name); apps/app_confbridge.c: ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeJoin", apps/app_confbridge.c: ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeLeave", apps/app_confbridge.c: manager_event(EVENT_FLAG_CALL, "ConfbridgeStartRecord", "Conference: %s\r\n", conf_name); apps/app_confbridge.c: manager_event(EVENT_FLAG_CALL, "ConfbridgeStopRecord", "Conference: %s\r\n", conf_name); apps/app_confbridge.c: ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeMute", apps/app_confbridge.c: ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeUnmute", apps/app_confbridge.c: ast_manager_event(bridge_channel->chan, EVENT_FLAG_CALL, "ConfbridgeTalking", pp_dial.c: ast_manager_event(src, EVENT_FLAG_CALL, "Dial", apps/app_fax.c: ast_manager_event(s->chan, EVENT_FLAG_CALL, apps/app_meetme.c: manager_event(EVENT_FLAG_CALL, "MeetmeEnd", "Meetme: %s\r\n", conf->confno); apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalking", apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeJoin", apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeMute", apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeMute", apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalkRequest", apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalkRequest", apps/app_meetme.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeLeave", apps/app_minivm.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MiniVoiceMail", "Action: SentNotification\rn\nMailbox: %s@%s\r\nCounter: %s\r\n", vmu->username, vmu->domain, counter); apps/app_queue.c: ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Join", apps/app_queue.c: ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Leave", apps/app_voicemail.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", apps/app_voicemail.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL)); cel/cel_manager.c: manager_event(EVENT_FLAG_CALL, "CEL", channels/chan_dahdi.c: ast_manager_event(chan, EVENT_FLAG_CALL, "DAHDIChannel", channels/chan_iax2.c: ast_manager_event(iaxs[fr->callno]->owner, EVENT_FLAG_CALL, "Hold", channels/chan_iax2.c: ast_manager_event(iaxs[fr->callno]->owner, EVENT_FLAG_CALL, "Hold", channels/chan_local.c: manager_event(EVENT_FLAG_CALL, "LocalBridge", channels/chan_sip.c: manager_event(EVENT_FLAG_CALL, "Hold", channels/chan_sip.c: manager_event(EVENT_FLAG_CALL, "SIPqualifypeerdone", channels/chan_sip.c: manager_event(EVENT_FLAG_CALL, "SessionTimeout", "Source: RTPTimeout\r\n" channels/chan_sip.c: manager_event(EVENT_FLAG_CALL, "SessionTimeout", "Source: SIPSessionTimer\r\n" channels/sig_pri.c: ast_manager_event(chan, EVENT_FLAG_CALL, "Hold", main/cdr.c: ast_manager_event(chan, EVENT_FLAG_CALL, "NewAccountCode", main/cdr.c: ast_manager_event(chan, EVENT_FLAG_CALL, "NewPeerAccount", main/channel.c: manager_event(EVENT_FLAG_CALL, "HangupRequest", main/channel.c: manager_event(EVENT_FLAG_CALL, "HangupRequest", main/channel.c: manager_event(EVENT_FLAG_CALL, "SoftHangupRequest", main/channel.c: ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", main/channel.c: ast_manager_event(chan, EVENT_FLAG_CALL, "NewCallerid", main/features.c: ast_manager_event(chan, EVENT_FLAG_CALL, "ParkedCall", main/features.c: manager_event(EVENT_FLAG_CALL, s, main/features.c: ast_manager_event(pu->chan, EVENT_FLAG_CALL, "UnParkedCall", main/features.c: ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", main/features.c: ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", main/features.c: ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", main/features.c: ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", main/features.c: ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", main/manager.c: manager_event(EVENT_FLAG_CALL, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nHint: %s\r\nStatus: %d\r\n", exten, context, hint, state); main/manager.c: manager_event(EVENT_FLAG_CALL, manager_event, "%s", ast_str_buffer(channel_event_string)); res/res_fax.c: manager_event(EVENT_FLAG_CALL, res/res_fax.c: manager_event(EVENT_FLAG_CALL, res/res_fax.c: manager_event(EVENT_FLAG_CALL, res/res_monitor.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MonitorStart", res/res_monitor.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MonitorStop", res/res_musiconhold.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MusicOnHold", res/res_musiconhold.c: ast_manager_event(chan, EVENT_FLAG_CALL, "MusicOnHold", bash-3

If you want to issue commands without getting many events, you will need to only grant write permission. As the documentation says:

[quote]; Read authorization permits you to receive asynchronous events, in general.
; Write authorization permits you to send commands and get back responses. The
; following classes exist:
[/quote]

Thank you very much. I did try to find this in the documentation and was unsuccessful.

I plan on simply commenting out my read line for now. Besides no longer receives this event info (which I do not use at all), are there any other features that will be disabled?