[asterisk-commits] twilson: trunk r169510 - /trunk/main/features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 20 13:22:25 CST 2009


Author: twilson
Date: Tue Jan 20 13:22:24 2009
New Revision: 169510

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=169510
Log:
Make a proper builtin attended transfer to parking work

This is an ugly hack from 1.4 that allows the timeout callback from a parked
call to use the right channel name for the callback when the park is done with
a builtin attended transfer (that isn't completed early).  This hasn't ever
worked in trunk and no one has complained yet, so eh.

Modified:
    trunk/main/features.c

Modified: trunk/main/features.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/features.c?view=diff&rev=169510&r1=169509&r2=169510
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Tue Jan 20 13:22:24 2009
@@ -647,8 +647,30 @@
 	if (args->extout)
 		*(args->extout) = x;
 
-	if (peer) 
-		ast_copy_string(pu->peername, S_OR(args->orig_chan_name, peer->name), sizeof(pu->peername));
+	if (peer) { 
+		/* This is so ugly that it hurts, but implementing get_base_channel() on local channels
+			could have ugly side effects.  We could have transferer<->local,1<->local,2<->parking
+			and we need the callback name to be that of transferer.  Since local,1/2 have the same
+			name we can be tricky and just grab the bridged channel from the other side of the local
+		*/
+		if (!strcasecmp(peer->tech->type, "Local")) {
+			struct ast_channel *tmpchan, *base_peer;
+			char other_side[AST_CHANNEL_NAME];
+			char *c;
+			ast_copy_string(other_side, S_OR(args->orig_chan_name, peer->name), sizeof(other_side));
+			if ((c = strrchr(other_side, ';'))) {
+				*++c = '1';
+			}
+			if ((tmpchan = ast_get_channel_by_name_locked(other_side))) {
+				if ((base_peer = ast_bridged_channel(tmpchan))) {
+					ast_copy_string(pu->peername, base_peer->name, sizeof(pu->peername));
+				}
+				ast_channel_unlock(tmpchan);
+			}
+		} else {
+			ast_copy_string(pu->peername, S_OR(args->orig_chan_name, peer->name), sizeof(pu->peername));
+		}
+	}
 
 	/* Remember what had been dialed, so that if the parking
 	   expires, we try to come back to the same place */




More information about the asterisk-commits mailing list