[asterisk-commits] file: branch file/stasis_peerevent r389224 - in /team/file/stasis_peerevent: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 20 10:17:02 CDT 2013
Author: file
Date: Mon May 20 10:16:59 2013
New Revision: 389224
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389224
Log:
Add a function for creating and publishing an endpoint blob.
Modified:
team/file/stasis_peerevent/include/asterisk/stasis_endpoints.h
team/file/stasis_peerevent/main/stasis_endpoints.c
Modified: team/file/stasis_peerevent/include/asterisk/stasis_endpoints.h
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis_peerevent/include/asterisk/stasis_endpoints.h?view=diff&rev=389224&r1=389223&r2=389224
==============================================================================
--- team/file/stasis_peerevent/include/asterisk/stasis_endpoints.h (original)
+++ team/file/stasis_peerevent/include/asterisk/stasis_endpoints.h Mon May 20 10:16:59 2013
@@ -97,6 +97,21 @@
struct stasis_message_type *type, struct ast_json *blob);
/*!
+ * \since 12
+ * \brief Creates and publishes a \ref ast_endpoint_blob message.
+ *
+ * The given \a blob should be treated as immutable and not modified after it is
+ * put into the message.
+ *
+ * \param endpoint Endpoint blob is associated with.
+ * \param type Message type for this blob.
+ * \param blob JSON object representing the data, or \c NULL for no data. If
+ * \c NULL, ast_json_null() is put into the object.
+ */
+void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type,
+ struct ast_json *blob);
+
+/*!
* \brief Message type for endpoint state changes.
* \since 12
*/
Modified: team/file/stasis_peerevent/main/stasis_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis_peerevent/main/stasis_endpoints.c?view=diff&rev=389224&r1=389223&r2=389224
==============================================================================
--- team/file/stasis_peerevent/main/stasis_endpoints.c (original)
+++ team/file/stasis_peerevent/main/stasis_endpoints.c Mon May 20 10:16:59 2013
@@ -77,6 +77,18 @@
ao2_ref(msg, +1);
return msg;
+}
+
+void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type,
+ struct ast_json *blob)
+{
+ RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+ if (blob) {
+ message = ast_endpoint_blob_create(endpoint, type, blob);
+ }
+ if (message) {
+ stasis_publish(ast_endpoint_topic(endpoint), message);
+ }
}
struct stasis_topic *ast_endpoint_topic_all(void)
More information about the asterisk-commits
mailing list