-
- Downloads
A simplistic router for stasis_message's.
Often times, when subscribing to a topic, one wants to handle different message types differently. While one could cascade if/else statements through the subscription handler, it is much cleaner to specify a different callback for each message type. The stasis_message_router is here to help! A stasis_message_router is constructed for a particular stasis_topic, which is subscribes to. Call stasis_message_router_unsubscribe() to cancel that subscription. Once constructed, routes can be added using stasis_message_router_add() (or stasis_message_router_set_default() for any messages not handled by other routes). There may be only one route per stasis_message_type. The route's callback is invoked just as if it were a callback for a subscription; but it only gets called for messages of the specified type. (issue ASTERISK-20887) Review: https://reviewboard.asterisk.org/r/2390/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Showing
- include/asterisk/stasis_message_router.h 89 additions, 0 deletionsinclude/asterisk/stasis_message_router.h
- main/stasis.c 4 additions, 4 deletionsmain/stasis.c
- main/stasis_cache.c 1 addition, 1 deletionmain/stasis_cache.c
- main/stasis_message.c 2 additions, 2 deletionsmain/stasis_message.c
- main/stasis_message_router.c 244 additions, 0 deletionsmain/stasis_message_router.c
- tests/test_stasis.c 147 additions, 0 deletionstests/test_stasis.c
Loading
Please register or sign in to comment