stasis: Add methods to allow for synchronous publishing to subscriber

This patch adds an API call to Stasis that allows a publisher to publish a
stasis message that will not return until a specific subscriber handles the
message. Since a subscriber can have their own forwarding topic which orders
messages from many topics, this allows a publisher who knows of that subscriber
to synchronize to that subscriber regardless of the forwarding relationships
between topics.

This is of particular use for dialplan applications that need to synchronize
on a particular subscriber's handling of a message.

(issue ASTERISK-22884)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3099/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@405311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2014-01-12 21:55:11 +00:00
parent 08e624708d
commit dde2d41715
5 changed files with 235 additions and 22 deletions

View File

@@ -261,6 +261,16 @@ int stasis_message_router_is_done(struct stasis_message_router *router)
return stasis_subscription_is_done(router->subscription);
}
void stasis_message_router_publish_sync(struct stasis_message_router *router,
struct stasis_message *message)
{
ast_assert(router != NULL);
ao2_bump(router);
stasis_publish_sync(router->subscription, message);
ao2_cleanup(router);
}
int stasis_message_router_add(struct stasis_message_router *router,
struct stasis_message_type *message_type,
stasis_subscription_cb callback, void *data)