diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-09-24 20:37:32 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-09-24 20:37:32 +0000 |
commit | b916eaad4c9e662e476b63c5bd5ff7367ad47b8e (patch) | |
tree | 2ee25d29ea79c98ad8cc69c4c70330ba1d5d4834 /channels/chan_iax2.c | |
parent | 57e652f2ac730bed6d3249ba8a8d4e317cc40be5 (diff) |
chan_iax2: Prevent some needless breaking of the native IAX2 bridge.
* Clean up some twisted code in the iax2_bridge() loop.
* Add AST_CONTROL_VIDUPDATE and AST_CONTROL_SRCCHANGE to a list of frames
to prevent the native bridge loop from breaking.
* Passing the AST_CONTROL_T38_PARAMETERS frame should also allow FAX over
a native IAX2 bridge.
(issue ABE-2912)
Review: https://reviewboard.asterisk.org/r/2870/
........
Merged revisions 399697 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 399708 from http://svn.asterisk.org/svn/asterisk/branches/11
For v12 and above this is really just documentation until IAX2 native
bridging is restored.
........
Merged revisions 399736 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index a9ea43796..fb68131b6 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5516,34 +5516,44 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha break; } other = (who == c0) ? c1 : c0; /* the 'other' channel */ - if ((f->frametype == AST_FRAME_CONTROL)) { - if (f->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) { + if (f->frametype == AST_FRAME_CONTROL) { + switch (f->subclass.integer) { + case AST_CONTROL_VIDUPDATE: + case AST_CONTROL_SRCUPDATE: + case AST_CONTROL_SRCCHANGE: + case AST_CONTROL_T38_PARAMETERS: + ast_write(other, f); + break; + case AST_CONTROL_PVT_CAUSE_CODE: ast_channel_hangupcause_hash_set(other, f->data.ptr, f->datalen); - } else if (f->subclass.integer != AST_CONTROL_SRCUPDATE) { + break; + default: *fo = f; *rc = who; - res = AST_BRIDGE_COMPLETE; + res = AST_BRIDGE_COMPLETE; break; } - } - if ((f->frametype == AST_FRAME_VOICE) || - (f->frametype == AST_FRAME_TEXT) || - (f->frametype == AST_FRAME_VIDEO) || - (f->frametype == AST_FRAME_IMAGE) || - (f->frametype == AST_FRAME_DTMF) || - (f->frametype == AST_FRAME_CONTROL && f->subclass.integer != AST_CONTROL_PVT_CAUSE_CODE)) { + if (res == AST_BRIDGE_COMPLETE) { + break; + } + } else if (f->frametype == AST_FRAME_VOICE + || f->frametype == AST_FRAME_TEXT + || f->frametype == AST_FRAME_VIDEO + || f->frametype == AST_FRAME_IMAGE) { + ast_write(other, f); + } else if (f->frametype == AST_FRAME_DTMF) { /* monitored dtmf take out of the bridge. * check if we monitor the specific source. */ int monitored_source = (who == c0) ? AST_BRIDGE_DTMF_CHANNEL_0 : AST_BRIDGE_DTMF_CHANNEL_1; - if (f->frametype == AST_FRAME_DTMF && (flags & monitored_source)) { + + if (flags & monitored_source) { *rc = who; *fo = f; res = AST_BRIDGE_COMPLETE; /* Remove from native mode */ break; } - /* everything else goes to the other side */ ast_write(other, f); } ast_frfree(f); |