Review Board 1.7.16


ARI: WebSocket event cleanup

Review Request #2754 - Created Aug. 8, 2013 and submitted

David Lee
/trunk
ASTERISK-21969
Reviewers
asterisk-dev
mjordan
Asterisk
Stasis events (which get distributed over the ARI WebSocket) are created
by subscribing to the channel_all_cached and bridge_all_cached topics,
filtering out events for channels/bridges currently subscribed to.

There are two issues with that. First was a race condition, where
messages in-flight to the master subscribe-to-all-things topic would get
sent out, even though the events happened before the channel was put
into Stasis. Secondly, as the number of channels and bridges grow in the
system, the work spent filtering messages becomes excessive.

Since r395954, individual channels and bridges have caching topics, and
can be subscribed to individually. This patch takes advantage, so that
channels and bridges are subscribed to on demand, instead of filtering
the global topics.

The one case where filtering is still required is handling BridgeMerge
messages, which are published directly to the bridge_all topic.

Other than the change to how subscriptions work, this patch mostly just
moves code around. Most of the work generating JSON objects from
messages was moved to .to_json handlers on the message types. The
callback functions handling app subscriptions were moved from res_stasis
(b/c they were global to the model) to stasis/app.c (b/c they are local
to the app now).
Put channels in/out of Stasis, and in/out of bridges, watching events on the
WebSocket.
Total:
4
Open:
0
Resolved:
4
Dropped:
0
Status:
From:
Review request changed
Updated (Aug. 27, 2013, 3:19 p.m.)
  • changed from pending to submitted
Committed in revision 397846

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.