summaryrefslogtreecommitdiff
path: root/main/stasis_message.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-05-22 12:01:37 +0000
committerMatthew Jordan <mjordan@digium.com>2014-05-22 12:01:37 +0000
commit9cee08f50240b7da7ddd5efc04a8ef0d31292e7a (patch)
tree0180f85de28dce14f04ed17a979152bf8d362d9d /main/stasis_message.c
parent3bac303dc95afbe60069247eda469d9b48cfd701 (diff)
res_corosync: Update module to work with Stasis (and compile)
This patch fixes res_corosync such that it works with Asterisk 12. This restores the functionality that was present in previous versions of Asterisk, and ensures compatibility with those versions by restoring the binary message format needed to pass information from/to them. The following changes were made in the core to support this: * The event system has been partially restored. All event definition and event types in this patch were pulled from Asterisk 11. Previously, we had hoped that this information would live in res_corosync; however, the approach in this patch seems to be better for a few reasons: (1) Theoretically, ast_events can be used by any module as a binary representation of a Stasis message. Given the structure of an ast_event object, that information has to live in the core to be used universally. For example, defining the payload of a device state ast_event in res_corosync could result in an incompatible device state representation in another module. (2) Much of this representation already lived in the core, and was not easily extensible. (3) The code already existed. :-) * Stasis message types now have a message formatter that converts their payload to an ast_event object. * Stasis message forwarders now handle forwarding to themselves. Previously this would result in an infinite recursive call. Now, this simply creates a new forwarding object with no forwards set up (as it is the thing it is forwarding to). This is advantageous for res_corosync, as returning NULL would also imply an unrecoverable error. Returning a subscription in this case allows for easier handling of message types that are published directly to an aggregate topic that has forwarders. Review: https://reviewboard.asterisk.org/r/3486/ ASTERISK-22912 #close ASTERISK-22372 #close ........ Merged revisions 414330 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_message.c')
-rw-r--r--main/stasis_message.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/stasis_message.c b/main/stasis_message.c
index 1db2ae97a..6132efc20 100644
--- a/main/stasis_message.c
+++ b/main/stasis_message.c
@@ -187,3 +187,8 @@ struct ast_json *stasis_message_to_json(
{
return INVOKE_VIRTUAL(to_json, msg, sanitize);
}
+
+struct ast_event *stasis_message_to_event(struct stasis_message *msg)
+{
+ return INVOKE_VIRTUAL(to_event, msg);
+} \ No newline at end of file