[svn-commits] russell: branch russell/ast_channel_ao2 r183634 - in /team/russell/ast_channe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Mar 21 12:10:42 CDT 2009


Author: russell
Date: Sat Mar 21 12:10:39 2009
New Revision: 183634

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183634
Log:
fix up name handling in do_masq()

Modified:
    team/russell/ast_channel_ao2/include/asterisk/channel.h
    team/russell/ast_channel_ao2/main/channel.c

Modified: team/russell/ast_channel_ao2/include/asterisk/channel.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/include/asterisk/channel.h?view=diff&rev=183634&r1=183633&r2=183634
==============================================================================
--- team/russell/ast_channel_ao2/include/asterisk/channel.h (original)
+++ team/russell/ast_channel_ao2/include/asterisk/channel.h Sat Mar 21 12:10:39 2009
@@ -847,9 +847,14 @@
 /*!
  * \brief Change channel name
  *
- * \note The channel must be locked before calling this function.
- */
-void ast_change_name(struct ast_channel *chan, char *newname);
+ * \pre The channel must be locked before calling this function.
+ *
+ * \param chan the channel to change the name of
+ * \param newname the name to change to
+ *
+ * \return nothing
+ */
+void ast_change_name(struct ast_channel *chan, const char *newname);
 
 /*!
  * \brief Unlink and release reference to a channel
@@ -1591,12 +1596,12 @@
  * \note This function does _not_ return a reference to the bridged channel.
  * The reason for this is mostly historical.  It _should_ return a reference,
  * but it will take a lot of work to make the code base account for that.
- * So, for the now, the old rules still apply for how to handle this function.
+ * So, for now, the old rules still apply for how to handle this function.
  * If this function is being used from the channel thread that owns the channel,
  * then a reference is already held, and channel locking is not required to
  * guarantee that the channel will stay around.  If this function is used
  * outside of the associated channel thread, the channel parameter 'chan'
- * MUST be locked before calling this function.  Also, 'chan' must reamain locked
+ * MUST be locked before calling this function.  Also, 'chan' must remain locked
  * for the entire time that the result of this function is being used.
  *
  * \param chan Current channel

Modified: team/russell/ast_channel_ao2/main/channel.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/main/channel.c?view=diff&rev=183634&r1=183633&r2=183634
==============================================================================
--- team/russell/ast_channel_ao2/main/channel.c (original)
+++ team/russell/ast_channel_ao2/main/channel.c Sat Mar 21 12:10:39 2009
@@ -3979,7 +3979,7 @@
 	return res;
 }
 
-void ast_change_name(struct ast_channel *chan, char *newname)
+void ast_change_name(struct ast_channel *chan, const char *newname)
 {
 	/* We must re-link, as the hash value will change here. */
 	ao2_unlink(channels, chan);
@@ -4100,27 +4100,22 @@
 	free_translation(clonechan);
 	free_translation(original);
 
-
 	/* Unlink the masquerade */
 	original->masq = NULL;
 	clonechan->masqr = NULL;
-	
+
 	/* Save the original name */
 	ast_copy_string(orig, original->name, sizeof(orig));
 	/* Save the new name */
 	ast_copy_string(newn, clonechan->name, sizeof(newn));
 	/* Create the masq name */
 	snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn);
-		
+
 	/* Copy the name from the clone channel */
-	ast_string_field_set(original, name, newn);
+	ast_change_name(original, newn);
 
 	/* Mangle the name of the clone channel */
-	ast_string_field_set(clonechan, name, masqn);
-	
-	/* Notify any managers of the change, first the masq then the other */
-	manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clonechan->uniqueid);
-	manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", orig, newn, original->uniqueid);
+	ast_change_name(clonechan, masqn);
 
 	/* Swap the technologies */	
 	t = original->tech;
@@ -4206,10 +4201,9 @@
 		return -1;
 	}
 
+	/* Mangle the name of the clone channel */
 	snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig);
-	/* Mangle the name of the clone channel */
-	ast_string_field_set(clonechan, name, zombn);
-	manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", masqn, zombn, clonechan->uniqueid);
+	ast_change_name(clonechan, zombn);
 
 	/* Update the type. */
 	t_pvt = original->monitor;
@@ -4303,7 +4297,7 @@
 	if (original->visible_indication) {
 		ast_indicate(original, original->visible_indication);
 	}
-	
+
 	/* Now, at this point, the "clone" channel is totally F'd up.  We mark it as
 	   a zombie so nothing tries to touch it.  If it's already been marked as a
 	   zombie, then free it now (since it already is considered invalid). */




More information about the svn-commits mailing list