Hi All,<br><br><span class="HcCDpe"><span class="EP8xU" style="color: rgb(121, 6, 25);">A few days ago Mark Michelson</span></span> 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. <br>
<br>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?<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_<div id=":6c" class="ArwC7c ckChnd">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", 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", cdr->channel);<br>
<br> if (cdr->answer.tv_sec || cdr->answer.tv_usec) {<br> cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec + (cdr->end.tv_usec - cdr->answer.tv_usec) / 1000000;<br> } else { cdr->billsec = 0;}<br>
<br>}</div>