summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/json.h12
-rw-r--r--include/asterisk/stasis.h26
2 files changed, 38 insertions, 0 deletions
diff --git a/include/asterisk/json.h b/include/asterisk/json.h
index 43b4b5cf5..61685fd9f 100644
--- a/include/asterisk/json.h
+++ b/include/asterisk/json.h
@@ -906,6 +906,18 @@ struct ast_json_payload {
*/
struct ast_json_payload *ast_json_payload_create(struct ast_json *json);
+struct ast_party_id;
+/*!
+ * \brief Construct an ast_party_id as JSON.
+ * \since 12.0.0
+ *
+ * \param party The party ID to represent as JSON.
+ *
+ * \return JSON object with \c name, \c number and \c subaddress objects
+ * for those that are valid in the party ID
+ */
+struct ast_json *ast_json_party_id(struct ast_party_id *party);
+
/*!@}*/
#endif /* _ASTERISK_JSON_H */
diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h
index 19ebb41c9..fd51cf51d 100644
--- a/include/asterisk/stasis.h
+++ b/include/asterisk/stasis.h
@@ -736,6 +736,32 @@ void stasis_log_bad_type_access(const char *name);
}
/*!
+ * \brief Boiler-plate removing macro for defining local message types.
+ *
+ * \code
+ * STASIS_MESSAGE_TYPE_DEFN_LOCAL(ast_foo_type,
+ * .to_ami = foo_to_ami,
+ * .to_json = foo_to_json,
+ * );
+ * \endcode
+ *
+ * \param name Name of message type.
+ * \param ... Virtual table methods for messages of this type.
+ * \since 12
+ */
+#define STASIS_MESSAGE_TYPE_DEFN_LOCAL(name, ...) \
+ static struct stasis_message_vtable _priv_ ## name ## _v = { \
+ __VA_ARGS__ \
+ }; \
+ static struct stasis_message_type *_priv_ ## name; \
+ static struct stasis_message_type *name(void) { \
+ if (_priv_ ## name == NULL) { \
+ stasis_log_bad_type_access(#name); \
+ } \
+ return _priv_ ## name; \
+ }
+
+/*!
* \brief Boiler-plate removing macro for initializing message types.
*
* \code