[asterisk-dev] Asterisk 1.6.2: CDR missing for .call files

Mario Moran mmoran at popa.hn
Mon Dec 7 12:39:17 CST 2009


Hello from a novice to Asterisk!

Asterisk 1.6.2 is not generating CDR for .call files for me.  Looking 
into the code I do not see code similar to patch from 
https://issues.asterisk.org/view.php?id=16222 applied.

I modified the code as follows....

@@ -4432,12 +4432,24 @@
                                        break;
 
                                case AST_CONTROL_BUSY:
-                               case AST_CONTROL_CONGESTION:
-                               case AST_CONTROL_ANSWER:
+                                       ast_cdr_busy(chan->cdr);
                                        *outstate = f->subclass.integer;
-                                       timeout = 0;            /* trick 
to force exit from the while() */
+                                       timeout = 0;
                                        break;
 
+                               case AST_CONTROL_CONGESTION:
+                                        ast_cdr_failed(chan->cdr);
+                                        *outstate = f->subclass.integer;
+                                        timeout = 0;
+                                        break;
+
+                               case AST_CONTROL_ANSWER:
+                                       ast_cdr_answer(chan->cdr);
+                                       *outstate = f->subclass.integer;
+                                       timeout = 0;            /* trick 
to force exit from the while() */
+
                                /* Ignore these */
                                case AST_CONTROL_PROGRESS:
                                case AST_CONTROL_PROCEEDING:


.. but still wasn't working...  So, looking further, I found this in 
ast_hangup():

02210    if (chan->cdr) {     /* End the CDR if it hasn't already */
02211       ast_cdr_end(chan->cdr);
02212       cdr = chan->cdr;
02213       chan->cdr = NULL;
02214    }

Then this is never true and the CDR is not detached/posted:

02245    if (chan->cdr && !ast_test_flag(chan->cdr, 
AST_CDR_FLAG_BRIDGED) &&
02246       !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED) &&
02247        (chan->cdr->disposition != AST_CDR_NULL || 
ast_test_flag(chan->cdr, AST_CDR_FLAG_DIALED))) {
02248       ast_channel_lock(chan);
02249         
02250       ast_cdr_end(chan->cdr);
02251       ast_cdr_detach(chan->cdr);
02252       chan->cdr = NULL;
02253       ast_channel_unlock(chan);
02254    }


I removed the first piece and then it works.... but is this right??

Mario




More information about the asterisk-dev mailing list