diff options
Diffstat (limited to 'main/framehook.c')
-rw-r--r-- | main/framehook.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/main/framehook.c b/main/framehook.c index 0d353cf36..053e11a76 100644 --- a/main/framehook.c +++ b/main/framehook.c @@ -160,6 +160,10 @@ int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interfac ast_frfree(frame); } + if (ast_channel_is_bridged(chan)) { + ast_softhangup_nolock(chan, AST_SOFTHANGUP_UNBRIDGE); + } + return framehook->id; } @@ -185,6 +189,10 @@ int ast_framehook_detach(struct ast_channel *chan, int id) } AST_LIST_TRAVERSE_SAFE_END; + if (!res && ast_channel_is_bridged(chan)) { + ast_softhangup_nolock(chan, AST_SOFTHANGUP_UNBRIDGE); + } + return res; } @@ -215,6 +223,12 @@ int ast_framehook_list_is_empty(struct ast_framehook_list *framehooks) int ast_framehook_list_contains_no_active(struct ast_framehook_list *framehooks) { + return ast_framehook_list_contains_no_active_of_type(framehooks, 0); +} + +int ast_framehook_list_contains_no_active_of_type(struct ast_framehook_list *framehooks, + enum ast_frame_type type) +{ struct ast_framehook *cur; if (!framehooks) { @@ -229,6 +243,9 @@ int ast_framehook_list_contains_no_active(struct ast_framehook_list *framehooks) if (cur->detach_and_destroy_me) { continue; } + if (type && cur->i.consume_cb && !cur->i.consume_cb(cur->i.data, type)) { + continue; + } return 0; } |