app_celgenuserevent.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "asterisk.h"
00031
00032 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 376657 $")
00033
00034 #include "asterisk/module.h"
00035 #include "asterisk/app.h"
00036 #include "asterisk/channel.h"
00037 #include "asterisk/cel.h"
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 static char *app = "CELGenUserEvent";
00060
00061 static int celgenuserevent_exec(struct ast_channel *chan, const char *data)
00062 {
00063 int res = 0;
00064 char *parse;
00065 AST_DECLARE_APP_ARGS(args,
00066 AST_APP_ARG(event);
00067 AST_APP_ARG(extra);
00068 );
00069
00070 if (ast_strlen_zero(data)) {
00071 return 0;
00072 }
00073
00074 parse = ast_strdupa(data);
00075 AST_STANDARD_APP_ARGS(args, parse);
00076
00077 ast_cel_report_event(chan, AST_CEL_USER_DEFINED, args.event, args.extra, NULL);
00078 return res;
00079 }
00080
00081 static int unload_module(void)
00082 {
00083 ast_unregister_application(app);
00084 return 0;
00085 }
00086
00087 static int load_module(void)
00088 {
00089 int res = ast_register_application_xml(app, celgenuserevent_exec);
00090 if (res) {
00091 return AST_MODULE_LOAD_DECLINE;
00092 } else {
00093 return AST_MODULE_LOAD_SUCCESS;
00094 }
00095 }
00096
00097 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generate an User-Defined CEL event",
00098 .load = load_module,
00099 .unload = unload_module,
00100 );