[asterisk-commits] file: branch 1.2 r40225 - /branches/1.2/funcs/func_cdr.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Aug 17 09:22:59 MST 2006


Author: file
Date: Thu Aug 17 11:22:58 2006
New Revision: 40225

URL: http://svn.digium.com/view/asterisk?rev=40225&view=rev
Log:
Use the last CDR entry instead of the first CDR entry for variable retrieving variables using the CDR dialplan function. (issue #7689 reported by voipgate)

Modified:
    branches/1.2/funcs/func_cdr.c

Modified: branches/1.2/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/funcs/func_cdr.c?rev=40225&r1=40224&r2=40225&view=diff
==============================================================================
--- branches/1.2/funcs/func_cdr.c (original)
+++ branches/1.2/funcs/func_cdr.c Thu Aug 17 11:22:58 2006
@@ -44,11 +44,12 @@
 	int argc;
 	char *argv[2];
 	int recursive = 0;
+	struct ast_cdr *cdr = chan->cdr;
 
 	if (ast_strlen_zero(data))
 		return NULL;
 	
-	if (!chan->cdr)
+	if (!cdr)
 		return NULL;
 
 	mydata = ast_strdupa(data);
@@ -61,7 +62,11 @@
 			recursive = 1;
 	}
 
-	ast_cdr_getvar(chan->cdr, argv[0], &ret, buf, len, recursive);
+	/* Find last entry */
+	while (cdr->next)
+		cdr = cdr->next;
+
+	ast_cdr_getvar(cdr, argv[0], &ret, buf, len, recursive);
 
 	return ret;
 }



More information about the asterisk-commits mailing list