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. <br>
<br>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?<br><br>Thanks again for your help.<br><br><br><br><div class="gmail_quote">
On Wed, Nov 12, 2008 at 12:34 PM, Mark Michelson <span dir="ltr"><<a href="mailto:mmichelson@digium.com">mmichelson@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Joel Jn-Francois wrote:<br>
> Hi<br>
><br>
> I am using this code below to calculate the duration and billsec of a<br>
> call in asterisk. It works fine when I test it with one call, however<br>
> if I make a 3-way call, when I hangup it crashes asterisks. When I check<br>
> the log I get this debug error right before it crashes:DEBUG[23679]<br>
> rtp.c: Oooh, something is weird, backing out.<br>
><br>
> Can anyone give me some insight as to what I am doing wrong.<br>
><br>
> struct tm tm;<br>
> timestr[128];<br>
> time_t t;<br>
><br>
> {<br>
> time(&t);<br>
> ast_localtime(&t, &tm, NULL);<br>
> strftime(timestr,128,DATE_FORMAT,&tm);<br>
><br>
> ast_cdr_end(cdr);<br>
><br>
> if (!cdr->end.tv_sec && !cdr->end.tv_usec)<br>
> ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n",<br>
> cdr->channel);<br>
><br>
> if (!cdr->start.tv_sec && !cdr->start.tv_usec)<br>
> ast_log(LOG_WARNING, "CDR on channel '%s' lacks start\n",<br>
> cdr->channel);<br>
><br>
> if (cdr->answer.tv_sec || cdr->answer.tv_usec) {<br>
> cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec +<br>
> (cdr->end.tv_usec - cdr->answer.tv_usec) / 1000000;<br>
> } else { cdr->billsec = 0;}<br>
><br>
> }<br>
><br>
<br>
</div></div>You may want to double check that cdr is non-NULL before proceeding in your code.<br>
<br>
When debugging crashes, the best place to start is by looking at a backtrace.<br>
There are instructions for how to obtain a backtrace using gdb in<br>
doc/backtrace.txt in the Asterisk source.<br>
<br>
Mark Michelson<br>
<br>
_______________________________________________<br>
--Bandwidth and Colocation Provided by <a href="http://www.api-digital.com--" target="_blank">http://www.api-digital.com--</a><br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>
</blockquote></div><br>