2001-10-31 15:28:08 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2001-10-31 15:28:08 +00:00
|
|
|
*
|
2005-01-21 07:06:25 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2001-10-31 15:28:08 +00:00
|
|
|
*
|
2004-10-03 04:19:59 +00:00
|
|
|
* Mark Spencer <markster@digium.com>
|
2001-10-31 15:28:08 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
2001-10-31 15:28:08 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
|
|
|
* \brief Call Detail Record API
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
|
|
|
|
2005-06-03 01:42:31 +00:00
|
|
|
#ifndef _ASTERISK_CDR_H
|
|
|
|
#define _ASTERISK_CDR_H
|
2001-10-31 15:28:08 +00:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
2008-07-03 17:16:44 +00:00
|
|
|
|
|
|
|
/*! \name CDR Flags */
|
|
|
|
/*@{ */
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
#define AST_CDR_FLAG_KEEP_VARS (1 << 0)
|
2004-06-20 22:46:42 +00:00
|
|
|
#define AST_CDR_FLAG_POSTED (1 << 1)
|
|
|
|
#define AST_CDR_FLAG_LOCKED (1 << 2)
|
|
|
|
#define AST_CDR_FLAG_CHILD (1 << 3)
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
#define AST_CDR_FLAG_POST_DISABLED (1 << 4)
|
2008-07-03 17:16:44 +00:00
|
|
|
#define AST_CDR_FLAG_BRIDGED (1 << 5)
|
|
|
|
#define AST_CDR_FLAG_MAIN (1 << 6)
|
|
|
|
#define AST_CDR_FLAG_ENABLE (1 << 7)
|
|
|
|
#define AST_CDR_FLAG_ANSLOCKED (1 << 8)
|
|
|
|
#define AST_CDR_FLAG_DONT_TOUCH (1 << 9)
|
Merged revisions 135799 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r135799 | murf | 2008-08-05 17:13:20 -0600 (Tue, 05 Aug 2008) | 34 lines
(closes issue #12982)
Reported by: bcnit
Tested by: murf
I discovered that also, in the previous bug fixes and changes,
the cdr.conf 'unanswered' option is not being obeyed, so
I fixed this.
And, yes, there are two 'answer' times involved in this
scenario, and I would agree with you, that the first
answer time is the time that should appear in the CDR.
(the second 'answer' time is the time that the bridge
was begun).
I made the necessary adjustments, recording the first
answer time into the peer cdr, and then using that to
override the bridge cdr's value.
To get the 'unanswered' CDRs to appear, I purposely
output them, using the dial cmd to mark them as
DIALED (with a new flag), and outputting them if
they bear that flag, and you are in the right mode.
I also corrected one small mention of the Zap device
to equally consider the dahdi device.
I heavily tested 10-sec-wait macros in dial, and
without the macro call; I tested hangups while the
macro was running vs. letting the macro complete
and the bridge form. Looks OK. Removed all the
instrumentation and debug.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-05 23:45:32 +00:00
|
|
|
#define AST_CDR_FLAG_POST_ENABLE (1 << 10)
|
|
|
|
#define AST_CDR_FLAG_DIALED (1 << 11)
|
2008-07-03 17:16:44 +00:00
|
|
|
/*@} */
|
2009-05-29 19:04:24 +00:00
|
|
|
#define AST_CDR_FLAG_ORIGINATED (1 << 11)
|
2004-06-20 22:46:42 +00:00
|
|
|
|
2008-07-03 17:16:44 +00:00
|
|
|
/*! \name CDR Flags - Disposition */
|
2007-12-11 14:17:29 +00:00
|
|
|
/*@{ */
|
Merged revisions 65200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r65200 | murf | 2007-05-18 16:06:27 -0600 (Fri, 18 May 2007) | 9 lines
Merged revisions 65172 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r65172 | murf | 2007-05-18 14:56:20 -0600 (Fri, 18 May 2007) | 1 line
This update will fix the situation that occurs as described by 9717, where when several targets are specified for a dial, if any one them reports FAIL, the whole call gets FAIL, even though others were ringing OK. I rearranged the priorities, so that a new disposition, NULL, is at the lowest level, and the disposition get init'd to NULL. Then, next up is FAIL, and next up is BUSY, then NOANSWER, then ANSWERED. All the related set routines will only do so if the disposition value to be set to is greater than what's already there. This gives the intended effect. So, if all the targets are busy, you'd get BUSY for the call disposition. If all get BUSY, but one, and that one rings is not answered, you get NOANSWER. If by some freak of nature, the NULL value doesn't get overridden, then the disp2str routine will report NOANSWER as before.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-18 22:33:51 +00:00
|
|
|
#define AST_CDR_NULL 0
|
|
|
|
#define AST_CDR_FAILED (1 << 0)
|
2001-10-31 15:28:08 +00:00
|
|
|
#define AST_CDR_BUSY (1 << 1)
|
Merged revisions 65200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r65200 | murf | 2007-05-18 16:06:27 -0600 (Fri, 18 May 2007) | 9 lines
Merged revisions 65172 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r65172 | murf | 2007-05-18 14:56:20 -0600 (Fri, 18 May 2007) | 1 line
This update will fix the situation that occurs as described by 9717, where when several targets are specified for a dial, if any one them reports FAIL, the whole call gets FAIL, even though others were ringing OK. I rearranged the priorities, so that a new disposition, NULL, is at the lowest level, and the disposition get init'd to NULL. Then, next up is FAIL, and next up is BUSY, then NOANSWER, then ANSWERED. All the related set routines will only do so if the disposition value to be set to is greater than what's already there. This gives the intended effect. So, if all the targets are busy, you'd get BUSY for the call disposition. If all get BUSY, but one, and that one rings is not answered, you get NOANSWER. If by some freak of nature, the NULL value doesn't get overridden, then the disp2str routine will report NOANSWER as before.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-18 22:33:51 +00:00
|
|
|
#define AST_CDR_NOANSWER (1 << 2)
|
2006-03-22 21:43:38 +00:00
|
|
|
#define AST_CDR_ANSWERED (1 << 3)
|
2007-12-11 14:17:29 +00:00
|
|
|
/*@} */
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \name CDR AMA Flags */
|
|
|
|
/*@{ */
|
2001-10-31 15:28:08 +00:00
|
|
|
#define AST_CDR_OMIT (1)
|
|
|
|
#define AST_CDR_BILLING (2)
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
#define AST_CDR_DOCUMENTATION (3)
|
2007-12-11 14:17:29 +00:00
|
|
|
/*@} */
|
2004-01-11 03:23:05 +00:00
|
|
|
|
|
|
|
#define AST_MAX_USER_FIELD 256
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
#define AST_MAX_ACCOUNT_CODE 20
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2005-05-30 14:30:47 +00:00
|
|
|
/* Include channel.h after relevant declarations it will need */
|
|
|
|
#include "asterisk/channel.h"
|
2005-11-06 21:00:35 +00:00
|
|
|
#include "asterisk/utils.h"
|
2005-05-30 14:30:47 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Responsible for call detail data */
|
2001-10-31 15:28:08 +00:00
|
|
|
struct ast_cdr {
|
|
|
|
/*! Caller*ID with text */
|
2005-01-17 22:53:36 +00:00
|
|
|
char clid[AST_MAX_EXTENSION];
|
2001-10-31 15:28:08 +00:00
|
|
|
/*! Caller*ID number */
|
|
|
|
char src[AST_MAX_EXTENSION];
|
|
|
|
/*! Destination extension */
|
|
|
|
char dst[AST_MAX_EXTENSION];
|
|
|
|
/*! Destination context */
|
|
|
|
char dcontext[AST_MAX_EXTENSION];
|
|
|
|
|
|
|
|
char channel[AST_MAX_EXTENSION];
|
|
|
|
/*! Destination channel if appropriate */
|
|
|
|
char dstchannel[AST_MAX_EXTENSION];
|
|
|
|
/*! Last application if appropriate */
|
|
|
|
char lastapp[AST_MAX_EXTENSION];
|
|
|
|
/*! Last application data */
|
|
|
|
char lastdata[AST_MAX_EXTENSION];
|
|
|
|
|
|
|
|
struct timeval start;
|
|
|
|
|
|
|
|
struct timeval answer;
|
|
|
|
|
|
|
|
struct timeval end;
|
|
|
|
/*! Total time in system, in seconds */
|
2006-03-01 17:53:05 +00:00
|
|
|
long int duration;
|
2001-10-31 15:28:08 +00:00
|
|
|
/*! Total time call is up, in seconds */
|
2006-03-01 17:53:05 +00:00
|
|
|
long int billsec;
|
2001-10-31 15:28:08 +00:00
|
|
|
/*! What happened to the call */
|
2009-06-26 15:28:53 +00:00
|
|
|
long int disposition;
|
2001-10-31 15:28:08 +00:00
|
|
|
/*! What flags to use */
|
2009-06-26 15:28:53 +00:00
|
|
|
long int amaflags;
|
2001-10-31 15:28:08 +00:00
|
|
|
/*! What account number to use */
|
2009-06-26 15:28:53 +00:00
|
|
|
char accountcode[AST_MAX_ACCOUNT_CODE];
|
|
|
|
/*! Account number of the last person we talked to */
|
|
|
|
char peeraccount[AST_MAX_ACCOUNT_CODE];
|
2004-06-20 22:46:42 +00:00
|
|
|
/*! flags */
|
2009-06-26 15:28:53 +00:00
|
|
|
unsigned int flags;
|
2008-06-11 17:44:39 +00:00
|
|
|
/*! Unique Channel Identifier
|
|
|
|
* 150 = 127 (max systemname) + "-" + 10 (epoch timestamp) + "." + 10 (monotonically incrementing integer) + NULL */
|
|
|
|
char uniqueid[150];
|
2009-06-26 15:28:53 +00:00
|
|
|
/* Linked group Identifier */
|
|
|
|
char linkedid[32];
|
2007-07-16 02:51:56 +00:00
|
|
|
/*! User field */
|
2004-01-11 03:23:05 +00:00
|
|
|
char userfield[AST_MAX_USER_FIELD];
|
2005-02-23 22:48:47 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*! A linked list for variables */
|
2005-02-23 22:48:47 +00:00
|
|
|
struct varshead varshead;
|
|
|
|
|
2004-06-20 15:19:36 +00:00
|
|
|
struct ast_cdr *next;
|
2001-10-31 15:28:08 +00:00
|
|
|
};
|
|
|
|
|
Merged revisions 135799 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r135799 | murf | 2008-08-05 17:13:20 -0600 (Tue, 05 Aug 2008) | 34 lines
(closes issue #12982)
Reported by: bcnit
Tested by: murf
I discovered that also, in the previous bug fixes and changes,
the cdr.conf 'unanswered' option is not being obeyed, so
I fixed this.
And, yes, there are two 'answer' times involved in this
scenario, and I would agree with you, that the first
answer time is the time that should appear in the CDR.
(the second 'answer' time is the time that the bridge
was begun).
I made the necessary adjustments, recording the first
answer time into the peer cdr, and then using that to
override the bridge cdr's value.
To get the 'unanswered' CDRs to appear, I purposely
output them, using the dial cmd to mark them as
DIALED (with a new flag), and outputting them if
they bear that flag, and you are in the right mode.
I also corrected one small mention of the Zap device
to equally consider the dahdi device.
I heavily tested 10-sec-wait macros in dial, and
without the macro call; I tested hangups while the
macro was running vs. letting the macro complete
and the bridge form. Looks OK. Removed all the
instrumentation and debug.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-05 23:45:32 +00:00
|
|
|
int ast_cdr_isset_unanswered(void);
|
2006-02-23 23:12:41 +00:00
|
|
|
void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int recur, int raw);
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_setvar(struct ast_cdr *cdr, const char *name, const char *value, int recur);
|
2006-12-18 15:38:50 +00:00
|
|
|
int ast_cdr_serialize_variables(struct ast_cdr *cdr, struct ast_str **buf, char delim, char sep, int recur);
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
|
|
|
|
int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
|
2005-02-23 22:48:47 +00:00
|
|
|
|
2001-10-31 15:28:08 +00:00
|
|
|
typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
|
|
|
|
|
2007-02-14 20:22:20 +00:00
|
|
|
/*! \brief Return TRUE if CDR subsystem is enabled */
|
|
|
|
int check_cdr_enabled(void);
|
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Allocate a CDR record
|
|
|
|
* \retval a malloc'd ast_cdr structure
|
|
|
|
* \retval NULL on error (malloc failure)
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
struct ast_cdr *ast_cdr_alloc(void);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Duplicate a record
|
|
|
|
* \retval a malloc'd ast_cdr structure,
|
|
|
|
* \retval NULL on error (malloc failure)
|
2005-07-25 22:56:18 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr);
|
2005-07-25 22:56:18 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Free a CDR record
|
2005-10-24 20:12:06 +00:00
|
|
|
* \param cdr ast_cdr structure to free
|
2007-03-30 17:57:47 +00:00
|
|
|
* Returns nothing
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_free(struct ast_cdr *cdr);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Discard and free a CDR record
|
2007-03-30 14:37:21 +00:00
|
|
|
* \param cdr ast_cdr structure to free
|
2007-03-30 17:57:47 +00:00
|
|
|
* Returns nothing -- same as free, but no checks or complaints
|
2007-03-30 14:37:21 +00:00
|
|
|
*/
|
|
|
|
void ast_cdr_discard(struct ast_cdr *cdr);
|
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Initialize based on a channel
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr Call Detail Record to use for channel
|
|
|
|
* \param chan Channel to bind CDR with
|
|
|
|
* Initializes a CDR and associates it with a particular channel
|
2007-07-16 02:51:56 +00:00
|
|
|
* \return 0 by default
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2003-02-02 19:37:23 +00:00
|
|
|
/*!
|
2007-07-16 02:51:56 +00:00
|
|
|
* \brief Initialize based on a channel
|
2003-02-02 19:37:23 +00:00
|
|
|
* \param cdr Call Detail Record to use for channel
|
|
|
|
* \param chan Channel to bind CDR with
|
|
|
|
* Initializes a CDR and associates it with a particular channel
|
2007-07-16 02:51:56 +00:00
|
|
|
* \return 0 by default
|
2003-02-02 19:37:23 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
|
2003-02-02 19:37:23 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Register a CDR handling engine
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param name name associated with the particular CDR handler
|
|
|
|
* \param desc description of the CDR handler
|
|
|
|
* \param be function pointer to a CDR handler
|
|
|
|
* Used to register a Call Detail Record handler.
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-08-21 02:11:39 +00:00
|
|
|
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Unregister a CDR handling engine
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param name name of CDR handler to unregister
|
|
|
|
* Unregisters a CDR by it's name
|
|
|
|
*/
|
2006-08-21 02:11:39 +00:00
|
|
|
void ast_cdr_unregister(const char *name);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Start a call
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr the cdr you wish to associate with the call
|
|
|
|
* Starts all CDR stuff necessary for monitoring a call
|
2007-03-30 17:57:47 +00:00
|
|
|
* Returns nothing
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_start(struct ast_cdr *cdr);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*! \brief Answer a call
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr the cdr you wish to associate with the call
|
|
|
|
* Starts all CDR stuff necessary for doing CDR when answering a call
|
2007-07-16 02:51:56 +00:00
|
|
|
* \note NULL argument is just fine.
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_answer(struct ast_cdr *cdr);
|
Merged revisions 65200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r65200 | murf | 2007-05-18 16:06:27 -0600 (Fri, 18 May 2007) | 9 lines
Merged revisions 65172 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r65172 | murf | 2007-05-18 14:56:20 -0600 (Fri, 18 May 2007) | 1 line
This update will fix the situation that occurs as described by 9717, where when several targets are specified for a dial, if any one them reports FAIL, the whole call gets FAIL, even though others were ringing OK. I rearranged the priorities, so that a new disposition, NULL, is at the lowest level, and the disposition get init'd to NULL. Then, next up is FAIL, and next up is BUSY, then NOANSWER, then ANSWERED. All the related set routines will only do so if the disposition value to be set to is greater than what's already there. This gives the intended effect. So, if all the targets are busy, you'd get BUSY for the call disposition. If all get BUSY, but one, and that one rings is not answered, you get NOANSWER. If by some freak of nature, the NULL value doesn't get overridden, then the disp2str routine will report NOANSWER as before.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-18 22:33:51 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief A call wasn't answered
|
Merged revisions 65200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r65200 | murf | 2007-05-18 16:06:27 -0600 (Fri, 18 May 2007) | 9 lines
Merged revisions 65172 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r65172 | murf | 2007-05-18 14:56:20 -0600 (Fri, 18 May 2007) | 1 line
This update will fix the situation that occurs as described by 9717, where when several targets are specified for a dial, if any one them reports FAIL, the whole call gets FAIL, even though others were ringing OK. I rearranged the priorities, so that a new disposition, NULL, is at the lowest level, and the disposition get init'd to NULL. Then, next up is FAIL, and next up is BUSY, then NOANSWER, then ANSWERED. All the related set routines will only do so if the disposition value to be set to is greater than what's already there. This gives the intended effect. So, if all the targets are busy, you'd get BUSY for the call disposition. If all get BUSY, but one, and that one rings is not answered, you get NOANSWER. If by some freak of nature, the NULL value doesn't get overridden, then the disp2str routine will report NOANSWER as before.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-18 22:33:51 +00:00
|
|
|
* \param cdr the cdr you wish to associate with the call
|
|
|
|
* Marks the channel disposition as "NO ANSWER"
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
* Will skip CDR's in chain with ANS_LOCK bit set. (see
|
|
|
|
* forkCDR() application.
|
Merged revisions 65200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r65200 | murf | 2007-05-18 16:06:27 -0600 (Fri, 18 May 2007) | 9 lines
Merged revisions 65172 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r65172 | murf | 2007-05-18 14:56:20 -0600 (Fri, 18 May 2007) | 1 line
This update will fix the situation that occurs as described by 9717, where when several targets are specified for a dial, if any one them reports FAIL, the whole call gets FAIL, even though others were ringing OK. I rearranged the priorities, so that a new disposition, NULL, is at the lowest level, and the disposition get init'd to NULL. Then, next up is FAIL, and next up is BUSY, then NOANSWER, then ANSWERED. All the related set routines will only do so if the disposition value to be set to is greater than what's already there. This gives the intended effect. So, if all the targets are busy, you'd get BUSY for the call disposition. If all get BUSY, but one, and that one rings is not answered, you get NOANSWER. If by some freak of nature, the NULL value doesn't get overridden, then the disp2str routine will report NOANSWER as before.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-18 22:33:51 +00:00
|
|
|
*/
|
|
|
|
extern void ast_cdr_noanswer(struct ast_cdr *cdr);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Busy a call
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr the cdr you wish to associate with the call
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
* Marks the channel disposition as "BUSY"
|
|
|
|
* Will skip CDR's in chain with ANS_LOCK bit set. (see
|
|
|
|
* forkCDR() application.
|
2007-03-30 17:57:47 +00:00
|
|
|
* Returns nothing
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_busy(struct ast_cdr *cdr);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Fail a call
|
2003-09-12 16:51:35 +00:00
|
|
|
* \param cdr the cdr you wish to associate with the call
|
Merged revisions 122046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r122046 | murf | 2008-06-12 07:47:34 -0600 (Thu, 12 Jun 2008) | 37 lines
(closes issue #10668)
Reported by: arkadia
Tested by: murf, arkadia
Options added to forkCDR() app and the CDR() func to
remove some roadblocks for CDR applications.
The "show application ForkCDR" output was upgraded
to more fully explain the inner workings of forkCDR.
The A option was added to forkCDR to force the
CDR system to NOT change the disposition on the
original CDR, after the fork. This involves
ast_cdr_answer, _busy, _failed, and so on.
The T option was added to forkCDR to force
obedience of the cdr LOCKED flag in the
ast_cdr_end, all the disposition changing
funcs (ast_cdr_answer, etc), and in the
ast_cdr_setvar func.
The CHANGES file was updated to explain ALL
the new options added to satisfy this bug report
(and some requests made verbally and via
email, irc, etc, over the past months/year)
The 's' option was added to the CDR() func,
to force it to skip LOCKED cdr's in the
chain.
Again, the new options should be totally transparent
to existing apps! Current behavior of CDR,
forkCDR, and the rest of the CDR system should
not change one little bit. Until you add the
new options, at least!
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 14:28:01 +00:00
|
|
|
* Marks the channel disposition as "FAILED"
|
|
|
|
* Will skip CDR's in chain with ANS_LOCK bit set. (see
|
|
|
|
* forkCDR() application.
|
2007-03-30 17:57:47 +00:00
|
|
|
* Returns nothing
|
2003-09-12 16:51:35 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_failed(struct ast_cdr *cdr);
|
2003-09-12 16:51:35 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Save the result of the call based on the AST_CAUSE_*
|
2003-09-12 16:51:35 +00:00
|
|
|
* \param cdr the cdr you wish to associate with the call
|
|
|
|
* \param cause the AST_CAUSE_*
|
2007-07-16 02:51:56 +00:00
|
|
|
* Returns nothing
|
2003-09-12 16:51:35 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_disposition(struct ast_cdr *cdr, int cause);
|
2003-09-12 16:51:35 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief End a call
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr the cdr you have associated the call with
|
|
|
|
* Registers the end of call time in the cdr structure.
|
2007-03-30 17:57:47 +00:00
|
|
|
* Returns nothing
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_end(struct ast_cdr *cdr);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
|
|
|
/*!
|
2007-07-16 02:51:56 +00:00
|
|
|
* \brief Detaches the detail record for posting (and freeing) either now or at a
|
|
|
|
* later time in bulk with other records during batch mode operation.
|
2005-06-03 01:42:31 +00:00
|
|
|
* \param cdr Which CDR to detach from the channel thread
|
|
|
|
* Prevents the channel thread from blocking on the CDR handling
|
2001-10-31 15:28:08 +00:00
|
|
|
* Returns nothing
|
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_detach(struct ast_cdr *cdr);
|
2005-06-03 01:42:31 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Spawns (possibly) a new thread to submit a batch of CDRs to the backend engines
|
2005-06-03 01:42:31 +00:00
|
|
|
* \param shutdown Whether or not we are shutting down
|
|
|
|
* Blocks the asterisk shutdown procedures until the CDR data is submitted.
|
|
|
|
* Returns nothing
|
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_submit_batch(int shutdown);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set the destination channel, if there was one
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr Which cdr it's applied to
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param chan Channel to which dest will be
|
2001-10-31 15:28:08 +00:00
|
|
|
* Sets the destination channel the CDR is applied to
|
|
|
|
* Returns nothing
|
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chan);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set the last executed application
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param cdr which cdr to act upon
|
|
|
|
* \param app the name of the app you wish to change it to
|
|
|
|
* \param data the data you want in the data field of app you set it to
|
|
|
|
* Changes the value of the last executed app
|
|
|
|
* Returns nothing
|
|
|
|
*/
|
2008-12-13 08:36:35 +00:00
|
|
|
void ast_cdr_setapp(struct ast_cdr *cdr, const char *app, const char *data);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2009-05-21 15:33:55 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set the answer time for a call
|
|
|
|
* \param cdr the cdr you wish to associate with the call
|
|
|
|
* \param t the answer time
|
|
|
|
* Starts all CDR stuff necessary for doing CDR when answering a call
|
|
|
|
* NULL argument is just fine.
|
|
|
|
*/
|
|
|
|
void ast_cdr_setanswer(struct ast_cdr *cdr, struct timeval t);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Set the disposition for a call
|
|
|
|
* \param cdr the cdr you wish to associate with the call
|
|
|
|
* \param disposition the new disposition
|
|
|
|
* Set the disposition on a call.
|
|
|
|
* NULL argument is just fine.
|
|
|
|
*/
|
|
|
|
void ast_cdr_setdisposition(struct ast_cdr *cdr, long int disposition);
|
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Convert a string to a detail record AMA flag
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param flag string form of flag
|
|
|
|
* Converts the string form of the flag to the binary form.
|
2007-07-16 02:51:56 +00:00
|
|
|
* \return the binary form of the flag
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_amaflags2int(const char *flag);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Disposition to a string
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param disposition input binary form
|
2001-10-31 15:28:08 +00:00
|
|
|
* Converts the binary form of a disposition to string form.
|
2007-07-16 02:51:56 +00:00
|
|
|
* \return a pointer to the string form
|
2001-10-31 15:28:08 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
char *ast_cdr_disp2str(int disposition);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Reset the detail record, optionally posting it first
|
2003-02-02 19:37:23 +00:00
|
|
|
* \param cdr which cdr to act upon
|
2004-09-24 21:33:48 +00:00
|
|
|
* \param flags |AST_CDR_FLAG_POSTED whether or not to post the cdr first before resetting it
|
|
|
|
* |AST_CDR_FLAG_LOCKED whether or not to reset locked CDR's
|
2003-02-02 19:37:23 +00:00
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *flags);
|
2003-02-02 19:37:23 +00:00
|
|
|
|
2008-07-03 17:16:44 +00:00
|
|
|
/*! Reset the detail record times, flags */
|
|
|
|
/*!
|
|
|
|
* \param cdr which cdr to act upon
|
|
|
|
* \param flags |AST_CDR_FLAG_POSTED whether or not to post the cdr first before resetting it
|
|
|
|
* |AST_CDR_FLAG_LOCKED whether or not to reset locked CDR's
|
|
|
|
*/
|
|
|
|
void ast_cdr_specialized_reset(struct ast_cdr *cdr, struct ast_flags *flags);
|
|
|
|
|
|
|
|
/*! Flags to a string */
|
|
|
|
/*!
|
2001-10-31 15:28:08 +00:00
|
|
|
* \param flags binary flag
|
|
|
|
* Converts binary flags to string flags
|
|
|
|
* Returns string with flag name
|
|
|
|
*/
|
2006-02-01 23:05:28 +00:00
|
|
|
char *ast_cdr_flags2str(int flags);
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Move the non-null data from the "from" cdr to the "to" cdr
|
|
|
|
* \param to the cdr to get the goodies
|
2007-03-30 14:37:21 +00:00
|
|
|
* \param from the cdr to give the goodies
|
|
|
|
*/
|
|
|
|
void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from);
|
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Set account code, will generate AMI event */
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_setaccount(struct ast_channel *chan, const char *account);
|
2009-06-26 15:28:53 +00:00
|
|
|
|
|
|
|
/*! \brief Set the peer account */
|
|
|
|
int ast_cdr_setpeeraccount(struct ast_channel *chan, const char *account);
|
2004-01-11 03:23:05 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Set AMA flags for channel */
|
|
|
|
int ast_cdr_setamaflags(struct ast_channel *chan, const char *amaflags);
|
2004-01-11 03:23:05 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Set CDR user field for channel (stored in CDR) */
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield);
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Append to CDR user field for channel (stored in CDR) */
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield);
|
2004-01-11 03:23:05 +00:00
|
|
|
|
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*! Update CDR on a channel */
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_update(struct ast_channel *chan);
|
2003-02-02 19:37:23 +00:00
|
|
|
|
2002-07-15 21:51:22 +00:00
|
|
|
|
2001-10-31 15:28:08 +00:00
|
|
|
extern int ast_default_amaflags;
|
|
|
|
|
2005-05-25 17:18:05 +00:00
|
|
|
extern char ast_default_accountcode[AST_MAX_ACCOUNT_CODE];
|
2001-10-31 15:28:08 +00:00
|
|
|
|
2006-02-01 23:05:28 +00:00
|
|
|
struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
|
2004-06-20 22:46:42 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Reload the configuration file cdr.conf and start/stop CDR scheduling thread */
|
2006-02-14 23:08:06 +00:00
|
|
|
int ast_cdr_engine_reload(void);
|
2005-06-03 01:42:31 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Load the configuration file cdr.conf and possibly start the CDR scheduling thread */
|
2006-02-01 23:05:28 +00:00
|
|
|
int ast_cdr_engine_init(void);
|
2005-06-03 01:42:31 +00:00
|
|
|
|
|
|
|
/*! Submit any remaining CDRs and prepare for shutdown */
|
2006-02-01 23:05:28 +00:00
|
|
|
void ast_cdr_engine_term(void);
|
2005-06-03 01:42:31 +00:00
|
|
|
|
|
|
|
#endif /* _ASTERISK_CDR_H */
|