38 #include "asterisk/stasis_message_router.h"
71 static const char resetcdr_app[] =
"ResetCDR";
73 enum reset_cdr_options {
74 OPT_DISABLE_DISPATCH = (1 << 0),
75 OPT_KEEP_VARS = (1 << 1),
76 OPT_ENABLE = (1 << 2),
108 if (payload->
reset) {
110 ast_log(AST_LOG_WARNING,
"Failed to reset CDRs on channel %s\n", payload->
channel_name);
121 ast_log(AST_LOG_WARNING,
"Failed to manipulate CDR for channel %s: no message router\n",
122 ast_channel_name(chan));
128 ast_log(AST_LOG_WARNING,
"Failed to manipulate CDR for channel %s: unable to create message\n",
137 static int resetcdr_exec(
struct ast_channel *chan,
const char *data)
140 ao2_alloc(
sizeof(*payload), NULL), ao2_cleanup);
148 if (!ast_strlen_zero(data)) {
160 return publish_app_cdr_message(chan, payload);
163 static int unload_module(
void)
175 static int load_module(
void)
195 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Tell Asterisk to not maintain a CDR for the current call");
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.
#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.
#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.
const char * channel_name
int ast_unregister_application(const char *app)
Unregister an application.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
unsigned int keep_variables
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_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
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.
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.
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.