[asterisk-dev] Asterisk crashes when hanging up a 3-way call.
Steve Murphy
murf at digium.com
Fri Nov 14 15:17:00 CST 2008
On Fri, 2008-11-14 at 11:56 -0500, Joel Jn-Francois wrote:
> Hi All,
>
> A few days ago Mark Michelson was able to help me figure out that
> asterisk was crashing when hanging up a 3-way call because the CDR was
> being set to Null at that point. However, the code below works
> perfectly for 2-way calling.
>
> Can anyone share some insight as to why the CDR might be null when
> hanging up a 3-way call? Or is there another way of calculating the
> duration and the billsec without using the CDR?
Joel--
It's an internal thing. Every channel starts out life with a CDR, at
least
in the current scheme of things. The code tosses the ones that aren't
useful (for the most part). It wasn't necessarily a problem that the
CDR was gone; it was because the entire channel was gone.
Mark fixed it.
While there are usually several ways to accomplish the same task in
Asterisk, AFAIK, there is no other way to easily calc those times at the
current moment, besides via CDR's. Hmmm. maybe queue logs... but if you
want to write up some nifty dialplan code and do it yourself, this is
always an option! I've heard
of people using a combination of the AMI and CDR's to get some info,
seen
fancy things done with ForkCDR(), NoCDR(), ResetCDR(), etc, to get
desired
results, also.
murf
>
> Thanks for your help.
>
> 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;}
>
> }
> _______________________________________________
> --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
--
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20081114/011eb62d/attachment-0001.bin
More information about the asterisk-dev
mailing list