Pasrsing Realtime AMI events

Hello! Im trying parse events and everything is ok. BUT! I’ve stucked at the next statement:

  1. Bridge created when 2 channels connected for voice translation.
  2. Bridge re-created when I press “HOLD ON” on phone.
  3. Bridge re-created when I press again “HOLD OFF” on phone.

And every time “Bridge” event has absolutely SAME parameters. How can I recognize that Birde was unlinked because of HOLD set “on” or “off”? Or maybe it’s simple end of conversation. Help me please.

p.s. asterisk version 11.6 - cert2

What you’re running into is one of the many reasons why Asterisk 13 exists.

In older versions of Asterisk, the event model did not convey the lifetime of channels and bridges in an intuitive fashion. They had a tendency to expose the implementation details of Asterisk. In your case, the Bridge event is fired every time we ‘link’ or ‘unlink’ channels out of the internal bridge loop - which, as you can see, happens quite often (such as when someone is put on Hold). This doesn’t convey what people expected, which is that a Bridge event fires only when participants are added completely or removed completely from the Bridge.

If you are building a new application on top of Asterisk, I highly recommend moving to Asterisk 13. You can read up on the new API specifications and how it treats channel/bridge lifetimes in the AMI v2.0 specification.

Thank you a lot for your answer an time!