diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-10-03 19:39:49 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-10-03 19:39:49 +0000 |
commit | cff192429bd66651c048666970fd386c0c962ae6 (patch) | |
tree | 3bd1db6a53610bb452e68cd7bc78920d8dbc6178 /apps/app_mixmonitor.c | |
parent | 6a844be566478d6fed1ec93c0836fbf5d5d46ff3 (diff) |
audiohooks: Reevaluate the bridge technology when an audiohook is added or removed.
Adding a mixmonitor to a channel causes the bridge to change technologies
from native to simple_bridge so the call can be recorded. However, when
the mixmonitor is stopped the bridge does not switch back to the native
technology.
* Added unbridge requests to reevaluate the bridge when a channel
audiohook is removed.
* Moved the unbridge request into ast_audiohook_attach() ensure that the
bridge reevaluates whenever an audiohook is attached. This simplified the
mixmonitor and chan_spy start code as well.
* Added defensive code to stop_mixmonitor_full() in case additional
arguments are ever added to the StopMixMonitor application.
* Made ast_framehook_detach() not do an unbridge request if the framehook
does not exist.
* Made ast_framehook_list_fixup() do an unbridge request if there are any
framehooks. Also simplified the loop.
ASTERISK-24195 #close
Reported by: Jonathan Rose
Review: https://reviewboard.asterisk.org/r/4046/
........
Merged revisions 424506 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@424507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_mixmonitor.c')
-rw-r--r-- | apps/app_mixmonitor.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 4b3da07c0..a993580b3 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -451,22 +451,11 @@ static void destroy_monitor_audiohook(struct mixmonitor *mixmonitor) static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) { - int res = 0; - - if (!chan) + if (!chan) { return -1; - - ast_audiohook_attach(chan, audiohook); - - if (!res) { - ast_channel_lock(chan); - if (ast_channel_is_bridged(chan)) { - ast_channel_set_unbridged_nolock(chan, 1); - } - ast_channel_unlock(chan); } - return res; + return ast_audiohook_attach(chan, audiohook); } /*! @@ -1149,7 +1138,8 @@ static int stop_mixmonitor_full(struct ast_channel *chan, const char *data) ast_channel_lock(chan); - datastore = ast_channel_datastore_find(chan, &mixmonitor_ds_info, args.mixmonid); + datastore = ast_channel_datastore_find(chan, &mixmonitor_ds_info, + S_OR(args.mixmonid, NULL)); if (!datastore) { ast_channel_unlock(chan); return -1; |