[asterisk-users] AMI and CDR(answer)
Murthy Gandikota
mgandikota at nts.net
Thu Oct 16 16:12:34 CDT 2014
in cdr.c
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
{
struct ast_cdr *duplicate;
struct ast_flags flags = { 0 };
if (_flags)
ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
for ( ; cdr ; cdr = cdr->next) {
/* Detach if post is requested */
if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) ||
!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED))
{
ast_cdr_end(cdr);
if ((duplicate =
ast_cdr_dup_unique_swap(cdr))) {
ast_cdr_detach(duplicate);
}
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
/* enable CDR only */
if (ast_test_flag(&flags,
AST_CDR_FLAG_POST_ENABLE)) {
ast_clear_flag(cdr,
AST_CDR_FLAG_POST_DISABLED);
continue;
}
/* clear variables */
if (!ast_test_flag(&flags,
AST_CDR_FLAG_KEEP_VARS)) {
ast_cdr_free_vars(cdr, 0);
}
/* Reset to initial state */
ast_clear_flag(cdr, AST_FLAGS_ALL);
memset(&cdr->start, 0, sizeof(cdr->start));
memset(&cdr->end, 0, sizeof(cdr->end));
memset(&cdr->answer, 0, sizeof(cdr->answer));
cdr->billsec = 0;
cdr->duration = 0;
ast_cdr_start(cdr);
cdr->disposition = AST_CDR_NOANSWER;
}
}
}
If this line:
memset(&cdr->answer, 0, sizeof(cdr->answer));
is commented away, should work.
________________________________
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Murthy
Gandikota
Sent: Thursday, October 16, 2014 11:24 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Hi Matthew,
Now that you helped me figure out the root cause of my problem, I am
wondering if there is a safe way to store CDR without altering the
non-custom fields (the converse of v option).
Thanks
________________________________
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Murthy
Gandikota
Sent: Thursday, October 16, 2014 10:44 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Apparently we are calling ResetCDR (not ForkCDR) in the Asterisk 11.5.1
That is causing the CDR(answer) to be erased between context. My bad.
________________________________
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Murthy
Gandikota
Sent: Thursday, October 16, 2014 9:45 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Suppose we have a dialplan as follows and sip.conf is set to forward the
call to [start] context, the CDR(diposition) in [start] context will be
"ANSWER" and in [next] will be "NO ANSWER". Right?
[start]
exten = s,1,answer()
same =>n,gotoif($[${SOMEVAR} = SOME_VAL]?next)
same =>n, hangup()
[next]
exten = s,1, VERBOSE(WE ARE HERE)
same =>n,hangup()
________________________________
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Matthew
Jordan
Sent: Thursday, October 16, 2014 8:55 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 9:31 PM, Murthy Gandikota <mgandikota at nts.net>
wrote:
Thanks, Matthew. I think CDR(answer) is, in the end, not very useful to
me if it changes from context to context. Suppose from AMI we generate a
status
I'm not sure what you mean by "changes from context to context". The
answer time on a CDR is reflective of when the channel was answered.
That can be altered if you choose to alter it in the dialplan via
ForkCDR, but generally, that time is conveyed from one CDR to another.
A specific example would help here.
event, what will be the CDR(answer)? I see that sometimes it is
returned
as the literal "Production" instead of a Date/Time or a blank
value.
I don't know what you mean here either. What version of Asterisk are you
using? Can you provide an example where you get said literal back, as
well as the dialplan that produces this behavior?
I
am only puzzled that no one created a patch for the first
timestamp when
a call is answered. If I get some free time, I will try to
create one.
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20141016/6a9411e4/attachment.html>
More information about the asterisk-users
mailing list