From: Terry Wilson Date: Tue, 13 Mar 2012 20:36:06 +0000 (+0000) Subject: Fix setting CDR variables in the hangup extension X-Git-Tag: 10.3.0~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f7fe58196a9df06a99a9be617088a71fc73a8ba;p=thirdparty%2Fasterisk.git Fix setting CDR variables in the hangup extension A previous CDR fix for setting CDR variables during a bridge via custom dialplan features broke setting CDR variables in the hangup extension. This patch fixes the issue. Review: https://reviewboard.asterisk.org/r/1794/ ........ Merged revisions 358978 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@358989 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/features.c b/main/features.c index e0b0323f19..f38ceadba4 100644 --- a/main/features.c +++ b/main/features.c @@ -4390,8 +4390,10 @@ before_you_go: /* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */ new_chan_cdr = pick_unlocked_cdr(chan->cdr); /* the proper chan cdr, if there are forked cdrs */ - /* If the channel CDR has been modified during the call, record the changes in the bridge cdr */ - if (new_chan_cdr && bridge_cdr) { + /* If the channel CDR has been modified during the call, record the changes in the bridge cdr, + * BUT, if we've gone through the h extension block above, the CDR got swapped so don't overwrite + * what was done in the h extension. What a mess. This is why you never touch CDR code. */ + if (new_chan_cdr && bridge_cdr && !h_context) { ast_cdr_copy_vars(bridge_cdr, new_chan_cdr); ast_copy_string(bridge_cdr->userfield, new_chan_cdr->userfield, sizeof(bridge_cdr->userfield)); bridge_cdr->amaflags = new_chan_cdr->amaflags;