127 if (args.argc != 2) {
129 ast_log(LOG_WARNING,
"The HANGUPCAUSE function must have 2 parameters, not %u\n", args.argc);
133 ast_channel_lock(chan);
135 ast_channel_unlock(chan);
138 ast_log(LOG_WARNING,
"Unable to find information for channel %s\n", args.channel);
142 if (!strcmp(args.type,
"ast")) {
144 }
else if (!strcmp(args.type,
"tech")) {
147 ast_log(LOG_WARNING,
"Information type not recognized (%s)\n", args.type);
169 static int hangupcause_keys_read(
struct ast_channel *chan,
const char *cmd,
char *data,
char *buf,
size_t len)
180 ast_channel_lock(chan);
182 ast_channel_unlock(chan);
202 static int hangupcause_clear_exec(
struct ast_channel *chan,
const char *data) {
203 ast_channel_lock(chan);
205 ast_channel_unlock(chan);
210 .
name =
"HANGUPCAUSE",
215 .
name =
"HANGUPCAUSE_KEYS",
216 .read = hangupcause_keys_read,
219 static const char app[] =
"HangupCauseClear";
228 static int unload_module(
void)
245 static int load_module(
void)
256 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"HANGUPCAUSE related functions and applications");
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
const char * ast_cause2str(int cause) attribute_pure
Gives the string form of a given cause code.
int ast_unregister_application(const char *app)
Unregister an application.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
struct ast_str * ast_channel_dialed_causes_channels(const struct ast_channel *chan)
Retrieve a comma-separated list of channels for which dialed cause information is available...
General Asterisk PBX channel definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Data structure associated with a custom dialplan function.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
static int hangupcause_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Core PBX routines and definitions.
Support for dynamic strings.
Module has failed to load, may be in an inconsistent state.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct ast_control_pvt_cause_code * ast_channel_dialed_causes_find(const struct ast_channel *chan, const char *chan_name)
Retrieve a ref-counted cause code information structure.
void ast_channel_dialed_causes_clear(const struct ast_channel *chan)
Clear all cause information from the channel.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#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_custom_function_register(acf)
Register a custom function.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define AST_APP_ARG(name)
Define an application argument.