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 #include "asterisk.h"
00027
00028 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 282979 $")
00029
00030 #include "asterisk/module.h"
00031 #include "asterisk/app.h"
00032 #include "asterisk/channel.h"
00033 #include "asterisk/cel.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 static char *app = "CELGenUserEvent";
00056
00057 static int celgenuserevent_exec(struct ast_channel *chan, const char *data)
00058 {
00059 int res = 0;
00060 char *parse;
00061 AST_DECLARE_APP_ARGS(args,
00062 AST_APP_ARG(event);
00063 AST_APP_ARG(extra);
00064 );
00065
00066 if (ast_strlen_zero(data)) {
00067 return 0;
00068 }
00069
00070 parse = ast_strdupa(data);
00071 AST_STANDARD_APP_ARGS(args, parse);
00072
00073 ast_cel_report_event(chan, AST_CEL_USER_DEFINED, args.event, args.extra, NULL);
00074 return res;
00075 }
00076
00077 static int unload_module(void)
00078 {
00079 int res;
00080
00081 res = ast_unregister_application(app);
00082
00083 ast_module_user_hangup_all();
00084
00085 return res;
00086 }
00087
00088 static int load_module(void)
00089 {
00090 int res = ast_register_application_xml(app, celgenuserevent_exec);
00091 if (res) {
00092 return AST_MODULE_LOAD_DECLINE;
00093 } else {
00094 return AST_MODULE_LOAD_SUCCESS;
00095 }
00096 }
00097
00098 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generate an User-Defined CEL event",
00099 .load = load_module,
00100 .unload = unload_module,
00101 );