38 #include "asterisk/stasis_channels.h"
39 #include "asterisk/stasis_message_router.h"
40 #include "asterisk/statsd.h"
99 ast_statsd_log_string(
"channels.count", AST_STATSD_GAUGE,
"+1", 1.0);
108 ast_statsd_log(
"channels.calltime", AST_STATSD_TIMER, age);
111 ast_statsd_log_string(
"channels.count", AST_STATSD_GAUGE,
"-1", 1.0);
133 static int unload_module(
void)
142 static int load_module(
void)
145 router = stasis_message_router_create(
163 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"Example of how to use Stasis",
164 .support_level = AST_MODULE_SUPPORT_EXTENDED,
166 .unload = unload_module,
167 .requires =
"res_statsd"
const char * stasis_message_type_name(const struct stasis_message_type *type)
Gets the name of a given message type.
struct ast_channel_snapshot_base * base
Asterisk main include file. File version handling, generic pbx functions.
int stasis_message_router_add(struct stasis_message_router *router, struct stasis_message_type *message_type, stasis_subscription_cb callback, void *data)
Add a route to a message router.
Time-related functions and macros.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Structure representing a change of snapshot of channel state.
void stasis_message_router_unsubscribe_and_join(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic, blocking until the final message has been processed...
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
const struct timeval * stasis_message_timestamp(const struct stasis_message *msg)
Get the time when a message was created.
struct timeval creationtime
Support for dynamic strings.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg)
Determine whether a message is the final message to be received on a subscription.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
struct ast_channel_snapshot * new_snapshot
Module has failed to load, may be in an inconsistent state.
struct stasis_message_type * ast_channel_snapshot_type(void)
Message type for ast_channel_snapshot_update.
struct ast_channel_snapshot * old_snapshot
int stasis_message_router_set_default(struct stasis_message_router *router, stasis_subscription_cb callback, void *data)
Sets the default route of a router.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#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.