[asterisk-commits] jpeeler: branch 1.6.2 r281391 - in /branches/1.6.2: ./ channels/chan_local.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 9 15:07:33 CDT 2010


Author: jpeeler
Date: Mon Aug  9 15:07:29 2010
New Revision: 281391

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281391
Log:
Merged revisions 281390 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r281390 | jpeeler | 2010-08-09 15:04:30 -0500 (Mon, 09 Aug 2010) | 13 lines
  
  Prevent loss of Caller ID information set on local channel after masquerade.
  
  Caller ID set on the channel before a masquerade occurs when using a local
  channel would cause the information to be lost. The problem was that the
  information was set on a channel destined to be hung up. The somewhat confusing
  fix is to detect if any Caller ID has been set on the channel and if so 
  preswap the Caller ID data so that basically the masquerade puts the data back.
  
  (closes issue #17138)
  Reported by: kobaz
  
  Review: https://reviewboard.asterisk.org/r/847/
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/channels/chan_local.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Mon Aug  9 15:07:29 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-279056,279206,279945,280088,280341,280448,280811,280982
+/branches/1.4:1-279056,279206,279945,280088,280341,280448,280811,280982,281390

Modified: branches/1.6.2/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_local.c?view=diff&rev=281391&r1=281390&r2=281391
==============================================================================
--- branches/1.6.2/channels/chan_local.c (original)
+++ branches/1.6.2/channels/chan_local.c Mon Aug  9 15:07:29 2010
@@ -384,6 +384,26 @@
 							p->chan->audiohooks = p->owner->audiohooks;
 							p->owner->audiohooks = audiohooks_swapper;
 						}
+
+						/* If any Caller ID was set, preserve it after masquerade like above. We must check
+						 * to see if Caller ID was set because otherwise we'll mistakingly copy info not
+						 * set from the dialplan and will overwrite the real channel Caller ID. The reason
+						 * for this whole preswapping action is because the Caller ID is set on the channel
+						 * thread (which is the to be masqueraded away local channel) before both local
+						 * channels are optimized away.
+						 */
+						if (p->owner->cid.cid_dnid || p->owner->cid.cid_num ||
+							p->owner->cid.cid_name || p->owner->cid.cid_ani ||
+							p->owner->cid.cid_rdnis || p->owner->cid.cid_pres ||  
+							p->owner->cid.cid_ani2 || p->owner->cid.cid_ton ||  
+							p->owner->cid.cid_tns) {
+
+							struct ast_callerid tmpcid;
+							tmpcid = p->owner->cid;
+							p->owner->cid = p->chan->_bridge->cid;
+							p->chan->_bridge->cid = tmpcid;
+						}
+
 						ast_app_group_update(p->chan, p->owner);
 						ast_channel_masquerade(p->owner, p->chan->_bridge);
 						ast_set_flag(p, LOCAL_ALREADY_MASQED);




More information about the asterisk-commits mailing list