summaryrefslogtreecommitdiff
path: root/main/framehook.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-09-19 12:50:08 +0000
committerKinsey Moore <kmoore@digium.com>2014-09-19 12:50:08 +0000
commit7f2623a26fcbeecf7b64b804d3d28e42bd8a2725 (patch)
treef683a5068221a1bdd1f42b9522190e33aea57354 /main/framehook.c
parent40e033a6b6022acd3fa0807b9b135f72cd8351e0 (diff)
PJSIP: Prevent T38 framehook being put on wrong channel
This change gives framehooks a reverse-direction masquerade callback in addition to chan_fixup_cb similar to the callback added to datastores to handle the same situation. The new callback provides the same parameters as the fixup callback, but is called on the new channel's framehooks before moving framehooks from the old channel to the new channel. This gives the framehooks an oppurtunity to decide whether they should remain on the new channel or be removed. This new callback is used to prevent the PJSIP T.38 framehook from remaining on a masqueraded channel if the new channel is not also a PJSIP channel. This was causing a crash when a local channel was masqueraded into a PJSIP channel and the framehook was executed on the local channel since the channel's tech private data was not structured as expected. Review: https://reviewboard.asterisk.org/r/4001/ ........ Merged revisions 423503 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423504 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423505 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/framehook.c')
-rw-r--r--main/framehook.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/framehook.c b/main/framehook.c
index ec4e1695f..8df3a31a4 100644
--- a/main/framehook.c
+++ b/main/framehook.c
@@ -227,6 +227,21 @@ void ast_framehook_list_fixup(struct ast_channel *old_chan, struct ast_channel *
struct ast_framehook *framehook;
int moved_framehook_id;
+ if (ast_channel_framehooks(new_chan)) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_channel_framehooks(new_chan)->list, framehook, list) {
+ if (framehook->i.disable_inheritance) {
+ ast_framehook_detach(new_chan, framehook->id);
+ continue;
+ }
+
+ if (framehook->i.chan_breakdown_cb) {
+ framehook->i.chan_breakdown_cb(framehook->i.data, framehook->id,
+ old_chan, new_chan);
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+ }
+
if (!ast_channel_framehooks(old_chan)) {
return;
}