Subscribing to events is additive?

I’m looking at the AMI documentation here and I’m not sure if subscribing to events is additive (cumulative) or does each call to the event action REPLACE the events subscribed to?

For example is subscribing to event A and then subscribing to event B the same as subscribing to A,B ? (Or does the B subscription replace the A subscription)

Note: I was unable to post a link to https://docs. asterisk. org/Asterisk_20_Documentation/API_Documentation/AMI_Actions/Events/ for some reason.

There is no “subscribing” to selected events in AMI. If you don’t specify “Events: Off” when you authenticate, you will get them all.

I’m specifying OFF on login, but then want to use the “Events” AMI command to subscribe. The link I posted seems to say you can subscribe…or am I misreading that document?

Oh, right, I forgot about this command.

I’ve never used it, but to be consistent with the “off” and “on” settings, my guess is that each invocation replaces the previous setting.

Just to confirm the above, I had a look at the source code. The main part of AMI is in main/manager.c. In there is a routine action_events(), which is called to handle the “Events” command. That in turn calls another routine set_eventmask(). That uses strings_to_mask() to parse the event-mask string, and then replaces the value of the session->send_events field with the parsed value. So there is no provision for incremental modifications to the previous value.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.