Channels: Masquerades to automatically move frame/audio hooks

Whenever possible, audiohooks and framehooks will now be copied over
to the channel that the masquerading channel gets cloned into. This
should occur for all audiohooks and most framehooks. As a result,
in Asterisk 12.5 and up, the AUDIOHOOK_INHERIT function is now
deprecated and its behavior is essentially the new default for all
audiohooks, plus some additional audiohooks/framehooks.

Review: https://reviewboard.asterisk.org/r/3721/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@418914 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2014-07-18 16:01:57 +00:00
parent 412484525b
commit 9ef593f706
12 changed files with 214 additions and 200 deletions

View File

@@ -6583,6 +6583,12 @@ static void channel_do_masquerade(struct ast_channel *original, struct ast_chann
AST_LIST_APPEND_LIST(ast_channel_datastores(original), ast_channel_datastores(clonechan), entry);
}
/* Move framehooks over */
ast_framehook_list_fixup(clonechan, original);
/* Move audiohooks over */
ast_audiohook_move_all(clonechan, original);
ast_autochan_new_channel(clonechan, original);
clone_variables(original, clonechan);
@@ -10300,6 +10306,13 @@ struct suppress_data {
int framehook_id;
};
static void suppress_framehook_fixup_cb(void *data, int framehook_id, struct ast_channel *old_chan, struct ast_channel *new_chan)
{
struct suppress_data *suppress = data;
suppress->framehook_id = framehook_id;
}
static struct ast_frame *suppress_framehook_event_cb(struct ast_channel *chan, struct ast_frame *frame, enum ast_framehook_event event, void *data)
{
struct suppress_data *suppress = data;
@@ -10351,6 +10364,7 @@ int ast_channel_suppress(struct ast_channel *chan, unsigned int direction, enum
.version = AST_FRAMEHOOK_INTERFACE_VERSION,
.event_cb = suppress_framehook_event_cb,
.destroy_cb = suppress_framehook_destroy_cb,
.chan_fixup_cb = suppress_framehook_fixup_cb,
};
int framehook_id;