[asterisk-commits] russell: branch russell/ast_channel_ao2 r183640 - in /team/russell/ast_channe...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Mar 21 12:44:41 CDT 2009
Author: russell
Date: Sat Mar 21 12:44:37 2009
New Revision: 183640
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183640
Log:
Minor tweaks in autochan stuff
Modified:
team/russell/ast_channel_ao2/include/asterisk/autochan.h
team/russell/ast_channel_ao2/main/autochan.c
Modified: team/russell/ast_channel_ao2/include/asterisk/autochan.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/include/asterisk/autochan.h?view=diff&rev=183640&r1=183639&r2=183640
==============================================================================
--- team/russell/ast_channel_ao2/include/asterisk/autochan.h (original)
+++ team/russell/ast_channel_ao2/include/asterisk/autochan.h Sat Mar 21 12:44:37 2009
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) <Year>, <Your Name Here>
+ * Copyright (C) 2009, Digium, Inc.
*
* Mark Michelson <mmichelson at digium.com>
*
@@ -16,12 +16,11 @@
* at the top of the source tree.
*/
-/*! \file
- *
+/*!
+ * \file
* \brief "smart" channels that update automatically if a channel is masqueraded
*
* \author Mark Michelson <mmichelson at digium.com>
- *
*/
#include "asterisk.h"
@@ -35,7 +34,8 @@
AST_LIST_ENTRY(ast_autochan) list;
};
-/*! \par Just what the $!@# is an autochan?
+/*!
+ * \par Just what the $!@# is an autochan?
*
* An ast_autochan is a structure which contains an ast_channel. The pointer
* inside an autochan has the ability to update itself if the channel it points
@@ -58,35 +58,44 @@
* the channel, then it is possible that your saved pointer will become invalid.
*/
-/* \brief set up a new ast_autochan structure
+/*!
+ * \brief set up a new ast_autochan structure
*
+ * \details
* Allocates and initializes an ast_autochan, sets the
* autochan's chan pointer to point to the chan parameter, and
* adds the autochan to the global list of autochans. The newly-
* created autochan is returned to the caller. This function will
* cause the refcount of chan to increase by 1.
*
+ * \param chan The channel our new autochan will point to
+ *
* \note autochans must be freed using ast_autochan_destroy
- * \param chan The channel our new autochan will point to
+ *
* \retval NULL Failure
* \retval non-NULL success
*/
struct ast_autochan *ast_autochan_setup(struct ast_channel *chan);
-/* \brief destroy an ast_autochan structure
+/*!
+ * \brief destroy an ast_autochan structure
*
+ * \details
* Removes the passed-in autochan from the list of autochans and
* unrefs the channel that is pointed to. Also frees the autochan
* struct itself. This function will unref the channel reference
* which was made in ast_autochan_setup
*
* \param autochan The autochan that you wish to destroy
+ *
* \retval void
*/
void ast_autochan_destroy(struct ast_autochan *autochan);
-/* \brief Switch what channel autochans point to
+/*!
+ * \brief Switch what channel autochans point to
*
+ * \details
* Traverses the list of autochans. All autochans which point to
* old_chan will be updated to point to new_chan instead. Currently
* this is only called from ast_do_masquerade in channel.c. If some
@@ -95,6 +104,7 @@
*
* \param old_chan The channel that autochans may currently point to
* \param new_chan The channel that we want to point those autochans to now
+ *
* \retval void
*/
void ast_autochan_new_channel(struct ast_channel *old_chan, struct ast_channel *new_chan);
Modified: team/russell/ast_channel_ao2/main/autochan.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/main/autochan.c?view=diff&rev=183640&r1=183639&r2=183640
==============================================================================
--- team/russell/ast_channel_ao2/main/autochan.c (original)
+++ team/russell/ast_channel_ao2/main/autochan.c Sat Mar 21 12:44:37 2009
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) <Year>, <Your Name Here>
+ * Copyright (C) 2009, Digium, Inc.
*
* Mark Michelson <mmichelson at digium.com>
*
@@ -16,15 +16,17 @@
* at the top of the source tree.
*/
-/*! \file
- *
+/*!
+ * \file
* \brief "smart" channels
*
* \author Mark Michelson <mmichelson at digium.com>
- *
*/
#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
#include "asterisk/autochan.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
@@ -64,7 +66,9 @@
}
AST_LIST_TRAVERSE_SAFE_END;
ast_channel_unlock(autochan->chan);
+
autochan->chan = ast_channel_unref(autochan->chan);
+
ast_free(autochan);
}
@@ -76,10 +80,9 @@
if (autochan->chan == old_chan) {
autochan->chan = ast_channel_unref(old_chan);
autochan->chan = ast_channel_ref(new_chan);
- if (option_debug > 1) {
- ast_log(LOG_DEBUG, "Autochan %p used to hold channel %s (%p) but now holds channel %s (%p)\n",
- autochan, old_chan->name, old_chan, new_chan->name, new_chan);
- }
+
+ ast_debug(1, "Autochan %p used to hold channel %s (%p) but now holds channel %s (%p)\n",
+ autochan, old_chan->name, old_chan, new_chan->name, new_chan);
}
}
}
More information about the asterisk-commits
mailing list