[asterisk-commits] dlee: branch dlee/stable-id r378027 - in /team/dlee/stable-id: ./ include/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 14 11:10:54 CST 2012


Author: dlee
Date: Fri Dec 14 11:10:49 2012
New Revision: 378027

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378027
Log:
Reduce masquerade insanity.

* Don't switch the Uniqueid's of the masqueraded channels
* Don't log so many renames

Modified:
    team/dlee/stable-id/UPGRADE.txt
    team/dlee/stable-id/include/asterisk/manager.h
    team/dlee/stable-id/main/channel.c

Modified: team/dlee/stable-id/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stable-id/UPGRADE.txt?view=diff&rev=378027&r1=378026&r2=378027
==============================================================================
--- team/dlee/stable-id/UPGRADE.txt (original)
+++ team/dlee/stable-id/UPGRADE.txt Fri Dec 14 11:10:49 2012
@@ -27,6 +27,17 @@
  - The SIP SIPqualifypeer action now sends a response indicating it will qualify
    a peer once a peer has been found to qualify.  Once the qualify has been
    completed it will now issue a SIPqualifypeerdone event.
+ - Version 1.4 - The details of what happens to a channel when a masquerade
+   happens (transfers, parking, etc) have changed.
+   - The Masquerade event now includes the Uniqueid's of the clone and original
+     channels.
+   - Channels no longer swap Uniqueid's as a result of the masquerade.
+   - Instead of a shell game of renames, there's now a single rename, appending
+     <ZOMBIE> to the name of the original channel.
+
+CEL:
+ - The Uniqueid field for a channel is now a stable identifier, and will not
+   change due to transfers, parking, etc.
 
 Queues:
  - Queue logging for PAUSEALL/UNPAUSEALL now only occurs if the interface this is

Modified: team/dlee/stable-id/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stable-id/include/asterisk/manager.h?view=diff&rev=378027&r1=378026&r2=378027
==============================================================================
--- team/dlee/stable-id/include/asterisk/manager.h (original)
+++ team/dlee/stable-id/include/asterisk/manager.h Fri Dec 14 11:10:49 2012
@@ -54,7 +54,7 @@
 - \ref manager.c Main manager code file
  */
 
-#define AMI_VERSION                     "1.3"
+#define AMI_VERSION                     "1.4"
 #define DEFAULT_MANAGER_PORT 5038	/* Default port for Asterisk management via TCP */
 #define DEFAULT_MANAGER_TLS_PORT 5039	/* Default port for Asterisk management via TCP */
 

Modified: team/dlee/stable-id/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stable-id/main/channel.c?view=diff&rev=378027&r1=378026&r2=378027
==============================================================================
--- team/dlee/stable-id/main/channel.c (original)
+++ team/dlee/stable-id/main/channel.c Fri Dec 14 11:10:49 2012
@@ -6856,9 +6856,8 @@
 	struct ast_format wformat;
 	struct ast_format tmp_format;
 	char newn[AST_CHANNEL_NAME];
-	char orig[AST_CHANNEL_NAME];
-	char masqn[AST_CHANNEL_NAME];
 	char zombn[AST_CHANNEL_NAME];
+	const char *tmp_id;
 	char clone_sending_dtmf_digit;
 	struct timeval clone_sending_dtmf_tv;
 
@@ -6975,10 +6974,17 @@
 	***/
 	ast_manager_event_multichan(EVENT_FLAG_CALL, "Masquerade", 2, chans,
 		"Clone: %s\r\n"
+		"CloneUniqueid: %s\r\n"
 		"CloneState: %s\r\n"
 		"Original: %s\r\n"
+		"CloneUniqueid: %s\r\n"
 		"OriginalState: %s\r\n",
-		ast_channel_name(clonechan), ast_state2str(ast_channel_state(clonechan)), ast_channel_name(original), ast_state2str(ast_channel_state(original)));
+		ast_channel_name(clonechan), ast_channel_uniqueid(clonechan), ast_state2str(ast_channel_state(clonechan)), ast_channel_name(original), ast_channel_uniqueid(original), ast_state2str(ast_channel_state(original)));
+
+	/* Swap uniqueid's of the channels */
+	tmp_id = ast_strdupa(ast_channel_uniqueid(clonechan));
+	ast_channel_uniqueid_set(clonechan, ast_channel_uniqueid(original));
+	ast_channel_uniqueid_set(original, tmp_id);
 
 	/*
 	 * Remember the original read/write formats.  We turn off any
@@ -6993,18 +6999,19 @@
 	clone_sending_dtmf_digit = ast_channel_sending_dtmf_digit(clonechan);
 	clone_sending_dtmf_tv = ast_channel_sending_dtmf_tv(clonechan);
 
-	/* Save the original name */
-	ast_copy_string(orig, ast_channel_name(original), sizeof(orig));
 	/* Save the new name */
 	ast_copy_string(newn, ast_channel_name(clonechan), sizeof(newn));
-	/* Create the masq name */
-	snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn);
-
-	/* Mangle the name of the clone channel */
-	__ast_change_name_nolink(clonechan, masqn);
-
-	/* Copy the name from the clone channel */
-	__ast_change_name_nolink(original, newn);
+	/* Create the zombie name */
+	snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", ast_channel_name(original)); /* quick, hide the brains! */
+
+	/*
+	 * Shuffle names around on the channels, and do so in such a way that we only send
+	 * one rename event: original -> original<ZOMBIE>. The other renames are implementation
+	 * details of the masquerade, and shouldn't generate events.
+	 */
+	ast_channel_name_set(clonechan, ast_channel_name(original));
+	__ast_change_name_nolink(clonechan, zombn);
+	ast_channel_name_set(original, newn);
 
 	/* share linked id's */
 	ast_channel_set_linkgroup(original, clonechan);
@@ -7070,10 +7077,6 @@
 	origstate = ast_channel_state(original);
 	ast_channel_state_set(original, ast_channel_state(clonechan));
 	ast_channel_state_set(clonechan, origstate);
-
-	/* Mangle the name of the clone channel */
-	snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig); /* quick, hide the brains! */
-	__ast_change_name_nolink(clonechan, zombn);
 
 	/* Update the type. */
 	t_pvt = ast_channel_monitor(original);




More information about the asterisk-commits mailing list