[Asterisk-cvs] asterisk/apps app_setcdruserfield.c,NONE,1.1 Makefile,1.45,1.46

jeremy at lists.digium.com jeremy at lists.digium.com
Sat Jan 10 21:31:19 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv15402/apps

Modified Files:
	Makefile 
Added Files:
	app_setcdruserfield.c 
Log Message:
Add application to log user data to the CDRs


--- NEW FILE: app_setcdruserfield.c ---
/*
 * Asterisk -- A telephony toolkit for Linux.
 *
 * Applictions connected with CDR engine
 * 
 * Copyright (C) 2003, Digium
 *
 * Justin Huff <jjhuff at mspin.net>
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License
 */

#include <sys/types.h>
#include <asterisk/channel.h>
#include <asterisk/cdr.h>
#include <asterisk/module.h>
#include <asterisk/pbx.h>
#include <asterisk/logger.h>

#include <stdlib.h>
#include <string.h>


static char *tdesc = "CDR user field apps";

static char *setcdruserfield_descrip = 
		"SetCDRUserField(value): Set the CDR user field to value\n";
		
static char *setcdruserfield_app = "SetCDRUserField";
static char *setcdruserfield_synopsis = "Set the CDR user field";

static char *appendcdruserfield_descrip = 
		"AppendCDRUserField(value): Append value to the CDR user field\n";
		
static char *appendcdruserfield_app = "AppendCDRUserField";
static char *appendcdruserfield_synopsis = "Append to the CDR user field";

STANDARD_LOCAL_USER;

LOCAL_USER_DECL;

static int setcdruserfield_exec(struct ast_channel *chan, void *data)
{
	struct localuser *u;
	int res = 0;
	
	LOCAL_USER_ADD(u)
	if (chan->cdr && data) 
	{
		ast_cdr_setuserfield(chan, (char*)data);
	}

	LOCAL_USER_REMOVE(u);
	
	return res;
}

static int appendcdruserfield_exec(struct ast_channel *chan, void *data)
{
	struct localuser *u;
	int res = 0;
	
	LOCAL_USER_ADD(u)
	if (chan->cdr && data) 
	{
		ast_cdr_appenduserfield(chan, (char*)data);
	}

	LOCAL_USER_REMOVE(u);
	
	return res;
}

int unload_module(void)
{
	int res;
	STANDARD_HANGUP_LOCALUSERS;
	res = ast_unregister_application(setcdruserfield_app);
	res |= ast_unregister_application(appendcdruserfield_app);
	return res;
}

int load_module(void)
{
	int res;
	res = ast_register_application(setcdruserfield_app, setcdruserfield_exec, setcdruserfield_synopsis, setcdruserfield_descrip);
	res |= ast_register_application(appendcdruserfield_app, appendcdruserfield_exec, appendcdruserfield_synopsis, appendcdruserfield_descrip);

	return res;
}

char *description(void)
{
	return tdesc;
}

int usecount(void)
{
	int res;
	STANDARD_USECOUNT(res);
	return res;
}

char *key()
{
	return ASTERISK_GPL_KEY;
}

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/Makefile,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- Makefile	13 Nov 2003 18:30:15 -0000	1.45
+++ Makefile	11 Jan 2004 03:23:05 -0000	1.46
@@ -24,7 +24,7 @@
      app_authenticate.so app_softhangup.so app_lookupblacklist.so \
      app_waitforring.so app_privacy.so app_db.so app_chanisavail.so \
      app_enumlookup.so app_transfer.so app_setcidnum.so app_cdr.so \
-     app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_read.so
+     app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_read.so app_setcdruserfield.so
 
 ifneq (${OSARCH},Darwin)
 APPS+=app_intercom.so




More information about the svn-commits mailing list