]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_iax2: Prevent some needless breaking of the native IAX2 bridge.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 24 Sep 2013 20:20:06 +0000 (20:20 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 24 Sep 2013 20:20:06 +0000 (20:20 +0000)
* 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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@399708 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index d185f1ad5f530ed6b222caad612723ae6254c028..30fa702d2e9444f608690e0e15eff6b541dbc19d 100644 (file)
@@ -5655,35 +5655,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 && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
+                       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 (!(flags & AST_BRIDGE_IGNORE_SIGS)
-                               && (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);