aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-17 16:22:58 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-17 16:22:58 +0000
commit82d34fb58313947ca7b19c2204c4140838ddd935 (patch)
tree127530fe73cae8bb2fad38a4d7788ab371c783a8 /funcs
parent4a8553f842464fdabf59000e32a9b5ed86ae9ed4 (diff)
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)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@40225 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_cdr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 3e4696e18..fdd241894 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -44,11 +44,12 @@ static char *builtin_function_cdr_read(struct ast_channel *chan, char *cmd, char
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 @@ static char *builtin_function_cdr_read(struct ast_channel *chan, char *cmd, char
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;
}