[svn-commits] murf: branch murf/newcdr r64029 - /team/murf/newcdr/apps/app_CELGenUserEvent.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri May 11 15:28:49 MST 2007


Author: murf
Date: Fri May 11 17:28:49 2007
New Revision: 64029

URL: http://svn.digium.com/view/asterisk?view=rev&rev=64029
Log:
added the app for generating user named events

Added:
    team/murf/newcdr/apps/app_CELGenUserEvent.c   (with props)

Added: team/murf/newcdr/apps/app_CELGenUserEvent.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/apps/app_CELGenUserEvent.c?view=auto&rev=64029
==============================================================================
--- team/murf/newcdr/apps/app_CELGenUserEvent.c (added)
+++ team/murf/newcdr/apps/app_CELGenUserEvent.c Fri May 11 17:28:49 2007
@@ -1,0 +1,105 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2005, Anthony Minessale anthmct at yahoo.com
+ * Development of this app Sponsered/Funded  by TAAN Softworks Corp
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Fork CDR application
+ *
+ * \author Anthony Minessale anthmct at yahoo.com
+ *
+ * \note Development of this app Sponsored/Funded by TAAN Softworks Corp
+ * 
+ * \ingroup applications
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/cel.h"
+#include "asterisk/module.h"
+
+static char *app = "CELGenUserEvent";
+static char *synopsis = 
+"Generates a CEL User Defined Event";
+static char *descrip = 
+	"  CELGenUserEvent(event-name):  \n"
+	"A CEL event will be immediately  generated by this channel,\n"
+	"with the supplied name for a type\n";
+
+
+
+static int CELGenUserEvent_exec(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	struct ast_module_user *u;
+	char *d2 = data;
+	char *d3;
+
+	while (d2 && *d2 && isspace(*d2)) /* trim leading blanks */
+		d2++;
+	
+	if (d2 && *d2)
+		d3=d2+strlen(d2)-1;
+	else
+		d3 = d2;
+	
+	while (d3 && *d3 && isspace(*d3)) {
+		*d3 = 0;
+		d3--;
+	}
+	
+	if (ast_strlen_zero(d2)) {
+		ast_log(LOG_ERROR, "CELGenUserEvent needs an event name!\n");
+		return 0;
+	}
+
+	u = ast_module_user_add(chan);
+
+	ast_cel_report_event(chan, CEL_USER_DEFINED, d2, NULL);
+
+	ast_module_user_remove(u);
+	return res;
+}
+
+static int unload_module(void)
+{
+	int res;
+
+	res = ast_unregister_application(app);
+
+	ast_module_user_hangup_all();
+
+	return res;	
+}
+
+static int load_module(void)
+{
+	return ast_register_application(app, CELGenUserEvent_exec, synopsis, descrip);
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Generate a User-Defined CEL event");

Propchange: team/murf/newcdr/apps/app_CELGenUserEvent.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/murf/newcdr/apps/app_CELGenUserEvent.c
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: team/murf/newcdr/apps/app_CELGenUserEvent.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain



More information about the svn-commits mailing list