? E22554v21td.pdf ? Tribute To Judge Judy.mp3.1 ? bc.mp3 ? cdr.diff.txt ? manpage.links ? manpage.refs ? voicemail.patch.txt Index: cdr.c =================================================================== RCS file: /usr/cvsroot/asterisk/cdr.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- cdr.c 3 Oct 2004 04:19:58 -0000 1.24 +++ cdr.c 3 Oct 2004 19:59:45 -0000 1.25 @@ -539,11 +539,16 @@ } -void ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr) { +struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr) +{ + struct ast_cdr *ret; if (cdr) { + ret = cdr; while(cdr->next) cdr = cdr->next; cdr->next = newcdr; - } else - ast_log(LOG_ERROR, "Can't append a CDR to NULL!\n"); + } else { + ret = newcdr; + } + return ret; } Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.516 retrieving revision 1.517 diff -u -r1.516 -r1.517 --- channels/chan_sip.c 3 Oct 2004 14:57:01 -0000 1.516 +++ channels/chan_sip.c 3 Oct 2004 19:59:45 -0000 1.517 @@ -7005,6 +7005,14 @@ ast_moh_stop(p1->owner->bridge); ast_moh_stop(p1->owner); ast_moh_stop(p2->owner); + if (p1->owner->cdr) { + p2->owner->cdr = ast_cdr_append(p2->owner->cdr, p1->owner->cdr); + p1->owner->cdr = NULL; + } + if (p1->owner->bridge->cdr) { + p2->owner->cdr = ast_cdr_append(p2->owner->cdr, p1->owner->bridge->cdr); + p1->owner->bridge->cdr = NULL; + } if (ast_channel_masquerade(p2->owner, p1->owner->bridge)) { ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", p2->owner->name, p1->owner->bridge->name); return -1; @@ -7013,6 +7021,14 @@ ast_moh_stop(p2->owner->bridge); ast_moh_stop(p2->owner); ast_moh_stop(p1->owner); + if (p2->owner->cdr) { + p1->owner->cdr = ast_cdr_append(p1->owner->cdr, p2->owner->cdr); + p2->owner->cdr = NULL; + } + if (p2->owner->bridge->cdr) { + p1->owner->cdr = ast_cdr_append(p1->owner->cdr, p2->owner->bridge->cdr); + p2->owner->bridge->cdr = NULL; + } if (ast_channel_masquerade(p1->owner, p2->owner->bridge)) { ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", p1->owner->name, p2->owner->bridge->name); return -1; Index: channels/chan_zap.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v retrieving revision 1.352 retrieving revision 1.353 diff -u -r1.352 -r1.353 --- channels/chan_zap.c 3 Oct 2004 14:52:33 -0000 1.352 +++ channels/chan_zap.c 3 Oct 2004 19:59:45 -0000 1.353 @@ -2875,6 +2875,18 @@ if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RINGING) { ast_indicate(p->subs[SUB_REAL].owner->bridge, AST_CONTROL_RINGING); } + if (p->subs[SUB_REAL].owner->cdr) { + /* Move CDR from second channel to current one */ + p->subs[SUB_THREEWAY].owner->cdr = + ast_cdr_append(p->subs[SUB_THREEWAY].owner->cdr, p->subs[SUB_REAL].owner->cdr); + p->subs[SUB_REAL].owner->cdr = NULL; + } + if (p->subs[SUB_REAL].owner->bridge->cdr) { + /* Move CDR from second channel's bridge to current one */ + p->subs[SUB_THREEWAY].owner->cdr = + ast_cdr_append(p->subs[SUB_THREEWAY].owner->cdr, p->subs[SUB_REAL].owner->bridge->cdr); + p->subs[SUB_REAL].owner->bridge->cdr = NULL; + } if (ast_channel_masquerade(p->subs[SUB_THREEWAY].owner, p->subs[SUB_REAL].owner->bridge)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", p->subs[SUB_REAL].owner->bridge->name, p->subs[SUB_THREEWAY].owner->name); @@ -2888,6 +2900,18 @@ ast_indicate(p->subs[SUB_THREEWAY].owner->bridge, AST_CONTROL_RINGING); } ast_moh_stop(p->subs[SUB_THREEWAY].owner->bridge); + if (p->subs[SUB_THREEWAY].owner->cdr) { + /* Move CDR from second channel to current one */ + p->subs[SUB_REAL].owner->cdr = + ast_cdr_append(p->subs[SUB_REAL].owner->cdr, p->subs[SUB_THREEWAY].owner->cdr); + p->subs[SUB_THREEWAY].owner->cdr = NULL; + } + if (p->subs[SUB_THREEWAY].owner->bridge->cdr) { + /* Move CDR from second channel's bridge to current one */ + p->subs[SUB_REAL].owner->cdr = + ast_cdr_append(p->subs[SUB_REAL].owner->cdr, p->subs[SUB_THREEWAY].owner->bridge->cdr); + p->subs[SUB_THREEWAY].owner->bridge->cdr = NULL; + } if (ast_channel_masquerade(p->subs[SUB_REAL].owner, p->subs[SUB_THREEWAY].owner->bridge)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", p->subs[SUB_THREEWAY].owner->bridge->name, p->subs[SUB_REAL].owner->name); Index: include/asterisk/cdr.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/cdr.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- include/asterisk/cdr.h 3 Oct 2004 04:19:58 -0000 1.13 +++ include/asterisk/cdr.h 3 Oct 2004 19:59:46 -0000 1.14 @@ -254,6 +254,6 @@ #define ast_cdr_add_flag(cdr, flag) ((cdr)->flags |= (flag)) #define ast_cdr_del_flag(cdr, flag) ((cdr)->flags &= ~(flag)) -extern void ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr); +extern struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr); #endif /* _CDR_H */