#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/manager.h"
#include "asterisk/app.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | unload_module (void) |
static int | userevent_exec (struct ast_channel *chan, void *data) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Custom User Event Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } |
static char * | app = "UserEvent" |
static struct ast_module_info * | ast_module_info = &__mod_info |
static char * | descrip |
static char * | synopsis = "Send an arbitrary event to the manager interface" |
Definition in file app_userevent.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 94 of file app_userevent.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 94 of file app_userevent.c.
static int load_module | ( | void | ) | [static] |
Definition at line 89 of file app_userevent.c.
References ast_register_application, and userevent_exec().
00090 { 00091 return ast_register_application(app, userevent_exec, synopsis, descrip); 00092 }
static int unload_module | ( | void | ) | [static] |
Definition at line 84 of file app_userevent.c.
References ast_unregister_application().
00085 { 00086 return ast_unregister_application(app); 00087 }
static int userevent_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 49 of file app_userevent.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_free, ast_log(), AST_STANDARD_APP_ARGS, ast_str_append(), ast_str_create(), ast_strdupa, ast_strlen_zero(), EVENT_FLAG_USER, LOG_WARNING, manager_event, parse(), and ast_str::str.
Referenced by load_module().
00050 { 00051 char *parse; 00052 int x; 00053 AST_DECLARE_APP_ARGS(args, 00054 AST_APP_ARG(eventname); 00055 AST_APP_ARG(extra)[100]; 00056 ); 00057 struct ast_str *body = ast_str_create(16); 00058 00059 if (ast_strlen_zero(data)) { 00060 ast_log(LOG_WARNING, "UserEvent requires an argument (eventname,optional event body)\n"); 00061 ast_free(body); 00062 return -1; 00063 } 00064 00065 if (!body) { 00066 ast_log(LOG_WARNING, "Unable to allocate buffer\n"); 00067 return -1; 00068 } 00069 00070 parse = ast_strdupa(data); 00071 00072 AST_STANDARD_APP_ARGS(args, parse); 00073 00074 for (x = 0; x < args.argc - 1; x++) { 00075 ast_str_append(&body, 0, "%s\r\n", args.extra[x]); 00076 } 00077 00078 manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s", args.eventname, body->str); 00079 ast_free(body); 00080 00081 return 0; 00082 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Custom User Event Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 94 of file app_userevent.c.
char* app = "UserEvent" [static] |
Definition at line 33 of file app_userevent.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 94 of file app_userevent.c.
char* descrip [static] |
Definition at line 37 of file app_userevent.c.
char* synopsis = "Send an arbitrary event to the manager interface" [static] |
Definition at line 35 of file app_userevent.c.