[asterisk-commits] murf: branch group/newcdr r117903 - in /team/group/newcdr: channels/ configs/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 22 14:05:32 CDT 2008


Author: murf
Date: Thu May 22 14:05:32 2008
New Revision: 117903

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117903
Log:
Got rid of the CEL function set. Access via CHANNEL and CALLERID() funcs instead. the eventtime/eventtype fields will be channel vars at event handling time. Got the configs updated, things seem to working.

Removed:
    team/group/newcdr/funcs/func_cel.c
Modified:
    team/group/newcdr/channels/chan_skinny.c
    team/group/newcdr/configs/cel_custom.conf.sample
    team/group/newcdr/configs/cel_sqlite3_custom.conf.sample
    team/group/newcdr/funcs/func_channel.c
    team/group/newcdr/include/asterisk/cel.h
    team/group/newcdr/main/cel.c

Modified: team/group/newcdr/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_skinny.c?view=diff&rev=117903&r1=117902&r2=117903
==============================================================================
--- team/group/newcdr/channels/chan_skinny.c (original)
+++ team/group/newcdr/channels/chan_skinny.c Thu May 22 14:05:32 2008
@@ -3122,7 +3122,7 @@
 						strsep(&cfg_context, "@");
 						if (ast_strlen_zero(cfg_context))
 							 cfg_context = "default";
-						l->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL,
+						l->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "Skinny mbox event", NULL,
 							AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, cfg_mailbox,
 							AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cfg_context,
 							AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,

Modified: team/group/newcdr/configs/cel_custom.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/configs/cel_custom.conf.sample?view=diff&rev=117903&r1=117902&r2=117903
==============================================================================
--- team/group/newcdr/configs/cel_custom.conf.sample (original)
+++ team/group/newcdr/configs/cel_custom.conf.sample Thu May 22 14:05:32 2008
@@ -6,4 +6,4 @@
 ; 
 ;
 ;[mappings]
-;Master.csv => "${CEL(eventtype)}","${CEL(eventtime)}","${CEL(cidname)}","${CEL(cidnum)}","${CEL(cidani)}","${CEL(cidrdnis)}","${CEL(ciddnid)}","${CEL(exten)}","${CEL(context)}","${CEL(channame)}","${CEL(appname)}","${CEL(appdata)}","${CEL(amaflags)}","${CEL(accountcode)}","${CEL(uniqueid)},"${CEL(peer)}","${CEL(userfield)}"
+;Master.csv => "${eventtype}","${eventtime}","${CALLERID(name)}","${CALLERID(num)}","${CALLERID(ANI)}","${CALLERID(RDNIS)}","${CALLERID(DNID)}","${CHANNEL(exten)}","${CHANNEL(context)}","${CHANNEL(channame)}","${CHANNEL(appname)}","${CHANNEL(appdata)}","${CHANNEL(amaflags)}","${CHANNEL(accountcode)}","${CHANNEL(uniqueid)},"${CHANNEL(peer)}","${CHANNEL(userfield)}"

Modified: team/group/newcdr/configs/cel_sqlite3_custom.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/configs/cel_sqlite3_custom.conf.sample?view=diff&rev=117903&r1=117902&r2=117903
==============================================================================
--- team/group/newcdr/configs/cel_sqlite3_custom.conf.sample (original)
+++ team/group/newcdr/configs/cel_sqlite3_custom.conf.sample Thu May 22 14:05:32 2008
@@ -4,4 +4,4 @@
 ;[master] ; currently, only file "master.db" is supported, with only one table at a time.
 ;table	=> cel
 ;columns	=> eventtype, eventtime, cidname, cidnum, cidani, cidrdnis, ciddnid, context, exten, channame, appname, appdata, amaflags, accountcode, uniqueid, userfield, peer
-;values	=> '${CEL(eventtype)}','${CEL(eventtime)}','${CEL(cidname)}','${CEL(cidnum)}','${CEL(cidani)}','${CEL(cidrdnis)}','${CEL(ciddnis)}','${CEL(context)}','${CEL(exten)}','${CEL(channame)}','${CEL(appname)}','${CEL(appdata)}','${CEL(amaflags)}','${CEL(accountcode)}','${CEL(uniqueid)}','${CEL(userfield)}','${CEL(peer)}'
+;values	=> '${eventtype}','${eventtime}','${CALLERID(name)}','${CALLERID(num)}','${CALLERID(ANI)}','${CALLERID(DNIS)}','${CALLERID(RDNIS)}','${CHANNEL(context)}','${CHANNEL(exten)}','${CHANNEL(channame)}','${CHANNEL(appname)}','${CHANNEL(appdata)}','${CHANNEL(amaflags)}','${CHANNEL(accountcode)}','${CHANNEL(uniqueid)}','${CHANNEL(userfield)}','${CHANNEL(peer)}'

Modified: team/group/newcdr/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/funcs/func_channel.c?view=diff&rev=117903&r1=117902&r2=117903
==============================================================================
--- team/group/newcdr/funcs/func_channel.c (original)
+++ team/group/newcdr/funcs/func_channel.c Thu May 22 14:05:32 2008
@@ -23,6 +23,7 @@
  * \ingroup functions
  */
 
+#include <ctype.h>
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -94,6 +95,18 @@
 		locked_copy_string(chan, buf, chan->accountcode, len);
 	else if (!strcasecmp(data, "peeraccount"))
 		locked_copy_string(chan, buf, chan->peeraccount, len);
+	else if (!strcasecmp(data, "appname") && chan->appl)
+		locked_copy_string(chan, buf, chan->appl, len);
+	else if (!strcasecmp(data, "appdata") && chan->data)
+		locked_copy_string(chan, buf, chan->data, len);
+	else if (!strcasecmp(data, "exten") && chan->data)
+		locked_copy_string(chan, buf, chan->exten, len);
+	else if (!strcasecmp(data, "context") && chan->data)
+		locked_copy_string(chan, buf, chan->context, len);
+	else if (!strcasecmp(data, "userfield") && chan->data)
+		locked_copy_string(chan, buf, chan->userfield, len);
+	else if (!strcasecmp(data, "channame") && chan->data)
+		locked_copy_string(chan, buf, chan->name, len);
 	else if (!strcasecmp(data, "linkedid")) {
 		ast_channel_lock(chan);
 		if (ast_strlen_zero(chan->linkedid)) {
@@ -104,12 +117,26 @@
 			ast_copy_string(buf, chan->linkedid, len);
 		}
 		ast_channel_unlock(chan);
-	}
-	else if (!strcasecmp(data, "transfercapability"))
+	} else if (!strcasecmp(data, "peer")) {
+		struct ast_channel *p;
+		ast_channel_lock(chan);
+		p = ast_bridged_channel(chan);
+		if (p || chan->tech || chan->cdr) /* dummy channel? if so, we hid the peer name in the language */
+			ast_copy_string(buf, (p ? p->name : ""), len);
+		else
+			ast_copy_string(buf, chan->language, len); /* a horrible kludge, but... how else? */
+		ast_channel_unlock(chan);
+	} else if (!strcasecmp(data, "uniqueid")) {
+		locked_copy_string(chan, buf, chan->uniqueid, len);
+	} else if (!strcasecmp(data, "transfercapability"))
 		locked_copy_string(chan, buf, transfercapability_table[chan->transfercapability & 0x1f], len);
 	else if (!strcasecmp(data, "callgroup")) {
 		char groupbuf[256];
 		locked_copy_string(chan, buf,  ast_print_group(groupbuf, sizeof(groupbuf), chan->callgroup), len);
+	} else if (!strcasecmp(data, "amaflags")) {
+		char amabuf[256];
+		snprintf(amabuf,sizeof(amabuf), "%d", chan->amaflags);
+		locked_copy_string(chan, buf, amabuf, len);
 	} else if (!chan->tech || !chan->tech->func_channel_read || chan->tech->func_channel_read(chan, function, data, buf, len)) {
 		ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n", data);
 		ret = -1;
@@ -132,7 +159,22 @@
 		locked_string_field_set(chan, musicclass, value);
 	else if (!strcasecmp(data, "accountcode"))
 		locked_string_field_set(chan, accountcode, value);
-	else if (!strcasecmp(data, "peeraccount"))
+	else if (!strcasecmp(data, "userfield"))
+		locked_string_field_set(chan, userfield, value);
+	else if (!strcasecmp(data, "amaflags")) {
+		ast_channel_lock(chan);
+		if(isdigit(*value)) {
+			
+			sscanf(value, "%d", &chan->amaflags);
+		} else if (!strcasecmp(value,"OMIT")){
+			chan->amaflags = 1;
+		} else if (!strcasecmp(value,"BILLING")){
+			chan->amaflags = 2;
+		} else if (!strcasecmp(value,"DOCUMENTATION")){
+			chan->amaflags = 3;
+		}
+		ast_channel_unlock(chan);
+	} else if (!strcasecmp(data, "peeraccount"))
 		locked_string_field_set(chan, peeraccount, value);
 #ifdef CHANNEL_TRACE
 	else if (!strcasecmp(data, "trace")) {
@@ -188,20 +230,35 @@
 	.desc = "Gets/set various pieces of information about the channel.\n"
 		"Standard items (provided by all channel technologies) are:\n"
 		"R/W	accountcode        account code used for logging in CDRs and CELs\n"
+		"R/W	amaflags           AMA Flags for CDRs and CELs\n"
+	    "                          When Reading, it will return a number:\n"
+	    "                            1=OMIT; 2=BILLING; 3=DOCUMENTATION\n"
+	    "                          When Writing, you can either specify 1,2, or 3,\n"
+	    "                            or OMIT, BILLING, or DOCUMENTATION\n"
+        "                          If other than OMIT, BILLING, or DOCUMENTATION\n"
+        "                            are specified, the value will not be changed.\n"
+		"R/O	appname            The name of a currently running application (dialplan)\n"
+		"R/O	appdata            The arguments supplied for calling the application (dialplan)\n"
 		"R/O	audioreadformat    format currently being read\n"
 		"R/O	audionativeformat  format used natively for audio\n"
 		"R/O	audiowriteformat   format currently being written\n"
 		"R/W	callgroup          call groups for call pickup\n"
+		"R/O	channame           The unique name of the channel\n"
 		"R/O	channeltype        technology used for channel\n"
+		"R/O	context            The current context in the dialplan\n"
+		"R/O	exten              The current extension in the dialplan\n"
 		"R/W	language           language for sounds played\n"
 		"R/O	linkdedid          unique id given to all participating channels in this call\n"
+		"R/O	uniquedid          unique id given to each channel\n"
 		"R/W	musicclass         class (from musiconhold.conf) for hold music\n"
 		"R/W	parkinglot         parkinglot for parking\n"
+		"R/O	peer               Returns the name of the bridged peer, if applicable\n"
 		"R/W	peeraccount        the account code that this channel is talking to\n"
 		"R/W	rxgain             set rxgain level on channel drivers that support it\n"
 		"R/O	state              state for channel\n"
 		"R/W	tonezone           zone for indications played\n"
 		"R/W	txgain             set txgain level on channel drivers that support it\n"
+		"R/W	userfield          get/set the userfield entry in the channel\n"
 		"R/O	videonativeformat  format used natively for video\n"
 #ifdef CHANNEL_TRACE
 		"R/W	trace              whether or not context tracing is enabled\n"

Modified: team/group/newcdr/include/asterisk/cel.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/cel.h?view=diff&rev=117903&r1=117902&r2=117903
==============================================================================
--- team/group/newcdr/include/asterisk/cel.h (original)
+++ team/group/newcdr/include/asterisk/cel.h Thu May 22 14:05:32 2008
@@ -110,9 +110,6 @@
 
 int ast_cel_amaflags2int(const char *flag);
 
-/*! CEL channel variable retrieval */
-void ast_cel_getvar(struct ast_channel *chan, const char *name, char **ret, char *workspace, int workspacelen, int raw) ;
-
 /*! Set a CEL channel variable 
 	\note You can't set the CEL variables that are managed by the PBX
 */

Modified: team/group/newcdr/main/cel.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/main/cel.c?view=diff&rev=117903&r1=117902&r2=117903
==============================================================================
--- team/group/newcdr/main/cel.c (original)
+++ team/group/newcdr/main/cel.c Thu May 22 14:05:32 2008
@@ -449,93 +449,6 @@
 	}
 }
 
-/*! CEL channel variable retrieval */
-void ast_cel_getvar(struct ast_channel *chan, const char *name, char **ret, char *workspace, int workspacelen, int raw) 
-{
-	const char *fmt = "%Y-%m-%d %T";
-
-	if (!chan)  /* don't die if the chan is null */
-		return;
-
-	*ret = NULL;
-
-	if (!strcasecmp(name, "cidname"))
-		ast_copy_string(workspace, chan->cid.cid_name, workspacelen);
-	else if (!strcasecmp(name, "cidnum"))
-		ast_copy_string(workspace, chan->cid.cid_num, workspacelen);
-	else if (!strcasecmp(name, "cidani"))
-		ast_copy_string(workspace, chan->cid.cid_ani, workspacelen);
-	else if (!strcasecmp(name, "cidrdnis"))
-		ast_copy_string(workspace, chan->cid.cid_rdnis, workspacelen);
-	else if (!strcasecmp(name, "ciddnid"))
-		ast_copy_string(workspace, chan->cid.cid_dnid, workspacelen);
-	else if (!strcasecmp(name, "exten"))
-		ast_copy_string(workspace, chan->exten, workspacelen);
-	else if (!strcasecmp(name, "context"))
-		ast_copy_string(workspace, chan->context, workspacelen);
-	else if (!strcasecmp(name, "channame"))
-		ast_copy_string(workspace, chan->name, workspacelen);
-	else if (!strcasecmp(name, "appname"))
-		ast_copy_string(workspace, chan->appl, workspacelen);
-	else if (!strcasecmp(name, "userfield"))
-		ast_copy_string(workspace, chan->userfield, workspacelen);
-	else if (!strcasecmp(name, "peer")) {
-		struct ast_channel *p = ast_bridged_channel(chan);
-		if (p || chan->tech || chan->cdr) /* dummy channel? if so, we hid the peer name in the language */
-			ast_copy_string(workspace, (p ? p->name : ""), workspacelen);
-		else
-			ast_copy_string(workspace, chan->language, workspacelen); /* a horrible kludge, but... how else? */
-	} else if (!strcasecmp(name, "appdata"))
-		ast_copy_string(workspace, chan->data, workspacelen);
-	else if (!strcasecmp(name, "eventtype")) { /* only available to the backends, and needs special handling via raw */
-		struct ast_var_t *variables;
-		struct varshead *headp = &chan->varshead;
-		const char *t2=0;
-		
-		AST_LIST_TRAVERSE(headp, variables, entries) {
-			if (!strcasecmp(name, ast_var_name(variables))) {
-				t2 = ast_var_value(variables);
-				break;
-			}
-		}
-		ast_copy_string(workspace, t2 ? t2 : "<none>",  workspacelen);
-	} else if (!strcasecmp(name, "eventtime")) { /* only available to the backends, and needs special handling via raw */
-		struct ast_var_t *variables;
-		struct varshead *headp = &chan->varshead;
-		const char *t2=0;
-		struct timeval tv2={0};
-		
-		AST_LIST_TRAVERSE(headp, variables, entries) {
-			if (!strcasecmp(name, ast_var_name(variables))) {
-				t2 = ast_var_value(variables);
-				break;
-			}
-		}
-		if (raw)
-			ast_copy_string(workspace, t2 ? t2 : "<none>",  workspacelen);
-		else if (!ast_strlen_zero(t2)) {
-			tv2.tv_sec = atoi(t2);
-			cel_get_tv(tv2, fmt, workspace, workspacelen);
-		} else
-			ast_copy_string(workspace,"<none>",workspacelen);
-		
-	} else if (!strcasecmp(name, "amaflags")) {
-		if (raw) {
-			snprintf(workspace, workspacelen, "%d", chan->amaflags);
-		} else {
-			ast_copy_string(workspace, ast_cel_flags2str(chan->amaflags), workspacelen);
-		}
-	} else if (!strcasecmp(name, "accountcode"))
-		ast_copy_string(workspace, chan->accountcode, workspacelen);
-	else if (!strcasecmp(name, "uniqueid"))
-		ast_copy_string(workspace, chan->uniqueid, workspacelen);
-	else
-		workspace[0] = '\0';
-
-	if (!ast_strlen_zero(workspace))
-		*ret = workspace;
-}
-
 /* this routine is only called to populate a dummy channel struct with the data,
    so the CEL func can grab the correct datum and have it substituted, the same as if
    a real channel were being used with the CEL func. What we do for re-use!! */




More information about the asterisk-commits mailing list