[asterisk-dev] [Code Review] Asterisk crashes when hanging up a 3-way call.
Joel Jn-Francois
voirtech at gmail.com
Wed Nov 12 21:05:09 CST 2008
Thanks for that insight. You are correct. CDR is null during the 3-way
call hangup, and that is whats causing asterisk to crash. I am guessing: Is
it that the hangup procedure is happening so fast at the same time that the
CDR may not be updating fast enough? With one call at a time it works
perfectly.
What is the best way to get an accurate duration and billsec time for both
calls during termination without getting a null value from the CDR?
Thanks again for your help.
On Wed, Nov 12, 2008 at 12:34 PM, Mark Michelson <mmichelson at digium.com>wrote:
> Joel Jn-Francois wrote:
> > Hi
> >
> > I am using this code below to calculate the duration and billsec of a
> > call in asterisk. It works fine when I test it with one call, however
> > if I make a 3-way call, when I hangup it crashes asterisks. When I check
> > the log I get this debug error right before it crashes:DEBUG[23679]
> > rtp.c: Oooh, something is weird, backing out.
> >
> > Can anyone give me some insight as to what I am doing wrong.
> >
> > struct tm tm;
> > timestr[128];
> > time_t t;
> >
> > {
> > time(&t);
> > ast_localtime(&t, &tm, NULL);
> > strftime(timestr,128,DATE_FORMAT,&tm);
> >
> > ast_cdr_end(cdr);
> >
> > if (!cdr->end.tv_sec && !cdr->end.tv_usec)
> > ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n",
> > cdr->channel);
> >
> > if (!cdr->start.tv_sec && !cdr->start.tv_usec)
> > ast_log(LOG_WARNING, "CDR on channel '%s' lacks start\n",
> > cdr->channel);
> >
> > if (cdr->answer.tv_sec || cdr->answer.tv_usec) {
> > cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec +
> > (cdr->end.tv_usec - cdr->answer.tv_usec) / 1000000;
> > } else { cdr->billsec = 0;}
> >
> > }
> >
>
> You may want to double check that cdr is non-NULL before proceeding in your
> code.
>
> When debugging crashes, the best place to start is by looking at a
> backtrace.
> There are instructions for how to obtain a backtrace using gdb in
> doc/backtrace.txt in the Asterisk source.
>
> Mark Michelson
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20081112/3743dc82/attachment-0001.htm
More information about the asterisk-dev
mailing list