Thanks so much for that information. Do you know if that fix is already in asterisk 1.4.22 or will that be in the next release?<br><br><div class="gmail_quote">On Fri, Nov 14, 2008 at 4:17 PM, Steve Murphy <span dir="ltr"><<a href="mailto:murf@digium.com">murf@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 class="Ih2E3d">On Fri, 2008-11-14 at 11:56 -0500, Joel Jn-Francois wrote:<br>
> Hi All,<br>
><br>
> A few days ago Mark Michelson was able to help me figure out that<br>
> asterisk was crashing when hanging up a 3-way call because the CDR was<br>
> being set to Null at that point. However, the code below works<br>
> perfectly for 2-way calling.<br>
><br>
> Can anyone share some insight as to why the CDR might be null when<br>
> hanging up a 3-way call? Or is there another way of calculating the<br>
> duration and the billsec without using the CDR?<br>
<br>
</div>Joel--<br>
<br>
It's an internal thing. Every channel starts out life with a CDR, at<br>
least<br>
in the current scheme of things. The code tosses the ones that aren't<br>
useful (for the most part). It wasn't necessarily a problem that the<br>
CDR was gone; it was because the entire channel was gone.<br>
<br>
Mark fixed it.<br>
<br>
While there are usually several ways to accomplish the same task in<br>
Asterisk, AFAIK, there is no other way to easily calc those times at the<br>
current moment, besides via CDR's. Hmmm. maybe queue logs... but if you<br>
want to write up some nifty dialplan code and do it yourself, this is<br>
always an option! I've heard<br>
of people using a combination of the AMI and CDR's to get some info,<br>
seen<br>
fancy things done with ForkCDR(), NoCDR(), ResetCDR(), etc, to get<br>
desired<br>
results, also.<br>
<br>
murf<br>
<div class="Ih2E3d"><br>
><br>
> Thanks for your help.<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_<br>
> 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>
</div>> _______________________________________________<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>
<font color="#888888">--<br>
Steve Murphy<br>
Software Developer<br>
Digium<br>
</font><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>