[svn-commits] mmichelson: branch mmichelson/issue13538 r161676 - in /team/mmichelson/issue1...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Dec 8 09:40:07 CST 2008
Author: mmichelson
Date: Mon Dec 8 09:40:00 2008
New Revision: 161676
URL: http://svn.digium.com/view/asterisk?view=rev&rev=161676
Log:
First batch of work for fixing issue #13538. This passes the
"it compiles" test, but it most likely has bugs in it. I have
not yet tested its functionality at all.
Modified:
team/mmichelson/issue13538/ (props changed)
team/mmichelson/issue13538/include/asterisk/audiohook.h
team/mmichelson/issue13538/main/audiohook.c
Propchange: team/mmichelson/issue13538/
------------------------------------------------------------------------------
automerge = *
Propchange: team/mmichelson/issue13538/
------------------------------------------------------------------------------
automerge-email = mmichelson at digium.com
Propchange: team/mmichelson/issue13538/
------------------------------------------------------------------------------
svnmerge-integrated = /trunk:1-161352
Modified: team/mmichelson/issue13538/include/asterisk/audiohook.h
URL: http://svn.digium.com/view/asterisk/team/mmichelson/issue13538/include/asterisk/audiohook.h?view=diff&rev=161676&r1=161675&r2=161676
==============================================================================
--- team/mmichelson/issue13538/include/asterisk/audiohook.h (original)
+++ team/mmichelson/issue13538/include/asterisk/audiohook.h Mon Dec 8 09:40:00 2008
@@ -150,6 +150,13 @@
*/
int ast_audiohook_detach_list(struct ast_audiohook_list *audiohook_list);
+/*! \brief Move an audiohook from one channel to a new one
+ * \param old_chan The source of the audiohook to move
+ * \param new_chan The destination to which we want the audiohook to move
+ * \param source The source of the audiohook we want to move
+ */
+void ast_audiohook_move_by_source (struct ast_channel *old_chan, struct ast_channel *new_chan, const char *source);
+
/*!
* \brief Detach specified source audiohook from channel
*
Modified: team/mmichelson/issue13538/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/issue13538/main/audiohook.c?view=diff&rev=161676&r1=161675&r2=161676
==============================================================================
--- team/mmichelson/issue13538/main/audiohook.c (original)
+++ team/mmichelson/issue13538/main/audiohook.c Mon Dec 8 09:40:00 2008
@@ -412,6 +412,11 @@
return 0;
}
+/*! \brief find an audiohook based on its source
+ * \param audiohook_list The list of audiohooks to search in
+ * \param source The source of the audiohook we wish to find
+ * \return Return the corresponding audiohook or NULL if it cannot be found.
+ */
static struct ast_audiohook *find_audiohook_by_source(struct ast_audiohook_list *audiohook_list, const char *source)
{
struct ast_audiohook *audiohook = NULL;
@@ -432,6 +437,28 @@
}
return NULL;
+}
+
+void ast_audiohook_move_by_source (struct ast_channel *old_chan, struct ast_channel *new_chan, const char *source)
+{
+ struct ast_audiohook *audiohook = find_audiohook_by_source(old_chan->audiohooks, source);
+
+ if (!audiohook) {
+ return;
+ }
+
+ /*XXX Hopefully all this locking will help to prevent
+ * the audiohook from being killed off when its state is
+ * changed during the removal
+ */
+ ast_channel_lock(old_chan);
+ ast_channel_lock(new_chan);
+ ast_audiohook_lock(audiohook);
+ ast_audiohook_remove(old_chan, audiohook);
+ ast_audiohook_attach(new_chan, audiohook);
+ ast_audiohook_unlock(audiohook);
+ ast_channel_unlock(new_chan);
+ ast_channel_unlock(old_chan);
}
/*! \brief Detach specified source audiohook from channel
More information about the svn-commits
mailing list