34 #include "asterisk/stasis_system.h"
84 .to_ami = system_registry_to_ami,
87 .to_ami = cc_available_to_ami,
90 .to_ami = cc_offertimerstart_to_ami,
93 .to_ami = cc_requested_to_ami,
96 .to_ami = cc_requestacknowledged_to_ami,
99 .to_ami = cc_callerstopmonitoring_to_ami,
102 .to_ami = cc_callerstartmonitoring_to_ami,
105 .to_ami = cc_callerrecalling_to_ami,
108 .to_ami = cc_recallcomplete_to_ami,
111 .to_ami = cc_failure_to_ami,
114 .to_ami = cc_monitorfailed_to_ami,
124 if (!ast_system_registry_type()) {
128 registry =
ast_json_pack(
"{s: s, s: s, s: s, s: s, s: s, s: s}",
130 "channeltype", channeltype,
131 "username", username,
134 "cause",
S_OR(cause,
""));
155 const char *channeltype;
156 const char *username;
172 if (!ast_strlen_zero(cause)) {
173 ast_str_set(&cause_string, 0,
"Cause: %s\r\n", cause);
177 "ChannelType: %s\r\n"
182 channeltype, username, domain, status,
ast_str_buffer(cause_string));
200 core_id, callee, service);
208 unsigned int expires;
218 core_id, caller, expires);
236 core_id, caller, callee);
329 core_id, caller, reason);
355 ao2_cleanup(system_topic);
Struct containing info for an AMI event to send out.
Asterisk main include file. File version handling, generic pbx functions.
struct stasis_topic * ast_system_topic(void)
A Stasis Message Bus API topic which publishes messages regarding system changes. ...
static struct stasis_topic * system_topic
The Stasis Message Bus API topic for system level changes.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ast_system_publish_registry(const char *channeltype, const char *username, const char *domain, const char *status, const char *cause)
Publish a channel driver outgoing registration message.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
static void stasis_system_cleanup(void)
Cleanup the Stasis Message Bus API system level items.
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
#define STASIS_MESSAGE_TYPE_DEFN(name,...)
Boiler-plate messaging macro for defining public message types.
Support for dynamic strings.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
int ast_stasis_system_init(void)
Initialize the system level items for Stasis Message Bus API.
Abstract JSON element (object, array, string, int, ...).
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.