[svn-commits] twilson: trunk r89492 - in /trunk: ./ res/res_features.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Nov 21 13:20:34 CST 2007


Author: twilson
Date: Wed Nov 21 13:20:33 2007
New Revision: 89492

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

........
r89491 | twilson | 2007-11-21 12:59:27 -0600 (Wed, 21 Nov 2007) | 4 lines

If a channel gets masqueraded in the middle of a park, don't play the
announcement to the masqueraded channel, and dial back to the original
channel on timeout.

........

Modified:
    trunk/   (props changed)
    trunk/res/res_features.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=89492&r1=89491&r2=89492
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Wed Nov 21 13:20:33 2007
@@ -375,7 +375,7 @@
 }
 
 /* Park a call */
-int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
+static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout, char *orig_chan_name)
 {
 	struct parkeduser *pu, *cur;
 	int i, x = -1, parking_range;
@@ -440,8 +440,9 @@
 	pu->parkingtime = (timeout > 0) ? timeout : parkingtime;
 	if (extout)
 		*extout = x;
-
-	if (peer) 
+	if (!ast_strlen_zero(orig_chan_name))
+		ast_copy_string(pu->peername, orig_chan_name, sizeof(pu->peername));
+	else if (peer) 
 		ast_copy_string(pu->peername, peer->name, sizeof(pu->peername));
 
 	/* Remember what had been dialed, so that if the parking
@@ -485,7 +486,7 @@
 	if (!con)	/* Still no context? Bad */
 		ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
 	/* Tell the peer channel the number of the parking space */
-	if (peer && pu->parkingnum != -1) { /* Only say number if it's a number */
+	if ((peer && pu->parkingnum != -1 && ast_strlen_zero(orig_chan_name)) || (strlen(orig_chan_name) == strlen(peer->name) && !strncasecmp(peer->name, orig_chan_name, strlen(peer->name)))) { /* Only say number if it's a number and the channel hasn't been masqueraded away */
 		/* Make sure we don't start saying digits to the channel being parked */
 		ast_set_flag(peer, AST_FLAG_MASQ_NOSTREAM);
 		ast_say_digits(peer, pu->parkingnum, "", peer->language);
@@ -504,6 +505,12 @@
 		pthread_kill(parking_thread, SIGURG);
 	}
 	return 0;
+}
+
+/*! \brief Park a call */
+int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
+{
+	return park_call_full(chan, peer, timeout, extout, NULL);
 }
 
 /* Park call via masquraded channel */
@@ -2222,6 +2229,10 @@
 /*! \brief Park a call */
 static int park_call_exec(struct ast_channel *chan, void *data)
 {
+	/* Cache the original channel name in case we get masqueraded in the middle
+	 * of a park--it is still theoretically possible for a transfer to happen before
+	 * we get here, but it is _really_ unlikely */
+	char *orig_chan_name = ast_strdupa(chan->name);
 	/* Data is unused at the moment but could contain a parking
 	   lot context eventually */
 	int res = 0;
@@ -2241,7 +2252,7 @@
 		res = ast_safe_sleep(chan, 1000);
 	/* Park the call */
 	if (!res)
-		res = ast_park_call(chan, chan, 0, NULL);
+		res = park_call_full(chan, chan, 0, NULL, orig_chan_name);
 
 	ast_module_user_remove(u);
 




More information about the svn-commits mailing list