42 #include "asterisk/stasis_message_router.h"
96 static char *app =
"ForkCDR";
129 ast_log(AST_LOG_WARNING,
"Failed to fork CDR for channel %s\n",
134 static int forkcdr_exec(
struct ast_channel *chan,
const char *data)
150 if (!ast_strlen_zero(args.options)) {
154 if (!forkcdr_message_type()) {
155 ast_log(AST_LOG_WARNING,
"Failed to manipulate CDR for channel %s: no message type\n",
156 ast_channel_name(chan));
160 payload = ao2_alloc(
sizeof(*payload), NULL);
166 ast_log(AST_LOG_WARNING,
"Failed to manipulate CDR for channel %s: no message router\n",
167 ast_channel_name(chan));
172 payload->
flags = &flags;
175 ast_log(AST_LOG_WARNING,
"Failed to fork CDR for channel %s: unable to create message\n",
176 ast_channel_name(chan));
184 static int unload_module(
void)
196 static int load_module(
void)
208 forkcdr_callback, NULL);
218 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"Fork The CDR into 2 separate entities",
219 .support_level = AST_MODULE_SUPPORT_CORE,
221 .unload = unload_module,
Main Channel structure associated with a channel.
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.
const char * channel_name
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
int ast_cdr_fork(const char *channel_name, struct ast_flags *options)
Fork a CDR.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int ast_unregister_application(const char *app)
Unregister an application.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
struct stasis_message_router * ast_cdr_message_router(void)
Return the message router for the CDR engine.
General Asterisk PBX channel definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Core PBX routines and definitions.
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_message_router_remove(struct stasis_message_router *router, struct stasis_message_type *message_type)
Remove a route from a message router.
Module has failed to load, may be in an inconsistent state.
Structure used to handle boolean flags.
STASIS_MESSAGE_TYPE_DEFN_LOCAL(cdr_sync_message_type)
A message type used to synchronize with the CDR topic.
void stasis_message_router_publish_sync(struct stasis_message_router *router, struct stasis_message *message)
Publish a message to a message router's subscription synchronously.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
#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_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define AST_APP_ARG(name)
Define an application argument.