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: 340863 $")
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 int res;
00084
00085 res = ast_unregister_application(app);
00086
00087 ast_module_user_hangup_all();
00088
00089 return res;
00090 }
00091
00092 static int load_module(void)
00093 {
00094 int res = ast_register_application_xml(app, celgenuserevent_exec);
00095 if (res) {
00096 return AST_MODULE_LOAD_DECLINE;
00097 } else {
00098 return AST_MODULE_LOAD_SUCCESS;
00099 }
00100 }
00101
00102 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generate an User-Defined CEL event",
00103 .load = load_module,
00104 .unload = unload_module,
00105 );