I have a recording bridge with some snoop channels inside. After the last participant left the bridge(on each StasisEnd event I am checking if the bridge is empty), I am removing this empty bridge.
Before the bridge is removed I usually receive a RecordingFinished event. But not every time. Sometimes bridge removes faster and I have such string in logs:
stasis/app.c bridge BRIDGE_NAME unsubscribed from APP_NAME and no more events about RecordFinished on this bridge.
Perhaps it is normal behavior (async, etc). Can someone suggest best practices in this situation?
- To wait some seconds (or a minute?) a RecordFinished event before remove the empty bridge? The event will be sent and received some times, yes? I hope
- To make a timer to remove the bridge after the last participant left in another thread in a minute? But if the event will not be sent?
- To remove empty bridges by cron every minute?
- Maybe it is possible to not unsubscribe from bridge events after removing a bridge if some events are queued on an asterisk side?
PS. I think a bridge recording finish and RecordingFinished event send after the last channel leave the bridge? Is it true? Am I right?