Add ResetCDR application (with mods) (bug #235)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-09-08 21:52:45 +00:00
parent 979dc97f36
commit 441be8c4d7

18
pbx.c
View File

@@ -20,6 +20,7 @@
#include <asterisk/file.h>
#include <asterisk/callerid.h>
#include <asterisk/cdr.h>
#include <asterisk/config.h>
#include <asterisk/term.h>
#include <asterisk/manager.h>
#include <asterisk/ast_expr.h>
@@ -156,6 +157,7 @@ static int pbx_builtin_rtimeout(struct ast_channel *, void *);
static int pbx_builtin_atimeout(struct ast_channel *, void *);
static int pbx_builtin_wait(struct ast_channel *, void *);
static int pbx_builtin_setlanguage(struct ast_channel *, void *);
static int pbx_builtin_resetcdr(struct ast_channel *, void *);
static int pbx_builtin_setaccount(struct ast_channel *, void *);
static int pbx_builtin_ringing(struct ast_channel *, void *);
static int pbx_builtin_congestion(struct ast_channel *, void *);
@@ -263,6 +265,12 @@ static struct pbx_builtin {
"which has no first step, the PBX will treat it as though the user dialed an\n"
"invalid extension.\n" },
{ "ResetCDR", pbx_builtin_resetcdr,
"Resets the Call Data Record",
" ResetCDR([options]): Causes the Call Data Record to be reset, optionally\n"
"storing the current CDR before zeroing it out (if 'w' option is specifed).\n"
"record WILL be stored. Always returns 0.\n" },
{ "ResponseTimeout", pbx_builtin_rtimeout,
"Set maximum timeout awaiting response",
" ResponseTimeout(seconds): Set the maximum amount of time permitted after\n"
@@ -4066,6 +4074,16 @@ static int pbx_builtin_setlanguage(struct ast_channel *chan, void *data)
return 0;
}
static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data)
{
/* Reset the CDR as specified */
if (data)
ast_cdr_reset(chan->cdr, strchr((char *)data, 'w') ? 1 : 0);
else
ast_cdr_reset(chan->cdr, 0);
return 0;
}
static int pbx_builtin_setaccount(struct ast_channel *chan, void *data)
{
/* Copy the language as specified */