Fix T38 passthrough regression introduced by state changes.
authorJoshua Colp <jcolp@digium.com>
Wed, 27 Feb 2008 15:31:09 +0000 (15:31 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 27 Feb 2008 15:31:09 +0000 (15:31 +0000)
(closes issue #12078)
Reported by: dimas
Patches:
      v1-12078.patch uploaded by dimas (license 88)
(closes issue #12074)
Reported by: Ivan

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

channels/chan_sip.c
main/rtp.c

index dcf9226..d6e4272 100644 (file)
@@ -14521,12 +14521,12 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
                        if (IS_SIP_TECH(bridgepeer->tech)) {
                                bridgepvt = (struct sip_pvt*)(bridgepeer->tech_pvt);
                                if (bridgepvt->udptl) {
-                                       if (p->t38.state == T38_PEER_REINVITE) {
+                                       if (p->t38.state == T38_ENABLED && bridgepvt->t38.state == T38_PEER_REINVITE) {
                                                sip_handle_t38_reinvite(bridgepeer, p, 0);
                                                ast_rtp_set_rtptimers_onhold(p->rtp);
                                                if (p->vrtp)
                                                        ast_rtp_set_rtptimers_onhold(p->vrtp);  /* Turn off RTP timers while we send fax */
-                                       } else if (p->t38.state == T38_DISABLED && bridgepeer && (bridgepvt->t38.state == T38_ENABLED)) {
+                                       } else if (p->t38.state == T38_DISABLED && bridgepvt->t38.state == T38_ENABLED) {
                                                ast_log(LOG_WARNING, "RTP re-invite after T38 session not handled yet !\n");
                                                /* Insted of this we should somehow re-invite the other side of the bridge to RTP */
                                                /* XXXX Should we really destroy this session here, without any response at all??? */
@@ -14545,10 +14545,6 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
                                change_t38_state(p, T38_DISABLED);
                        }
                }
-               if ((p->t38.state == T38_LOCAL_REINVITE) || (p->t38.state == T38_LOCAL_DIRECT)) {
-                       /* If there was T38 reinvite and we are supposed to answer with 200 OK than this should set us to T38 negotiated mode */
-                       change_t38_state(p, T38_ENABLED);
-               }
 
                if (!req->ignore && p->owner) {
                        if (!reinvite) {
@@ -20795,6 +20791,7 @@ static int sip_handle_t38_reinvite(struct ast_channel *chan, struct sip_pvt *pvt
                                        ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
                                else
                                        ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
+                               change_t38_state(p, T38_LOCAL_REINVITE);
                                transmit_reinvite_with_sdp(p, TRUE, FALSE);
                        } else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
                                if (flag)
index f7078de..f5e22a9 100644 (file)
@@ -3359,7 +3359,8 @@ static enum ast_bridge_result bridge_native_loop(struct ast_channel *c0, struct
                } else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
                        if ((fr->subclass == AST_CONTROL_HOLD) ||
                            (fr->subclass == AST_CONTROL_UNHOLD) ||
-                           (fr->subclass == AST_CONTROL_VIDUPDATE)) {
+                           (fr->subclass == AST_CONTROL_VIDUPDATE) ||
+                           (fr->subclass == AST_CONTROL_T38)) {
                                if (fr->subclass == AST_CONTROL_HOLD) {
                                        /* If we someone went on hold we want the other side to reinvite back to us */
                                        if (who == c0)
@@ -3597,7 +3598,8 @@ static enum ast_bridge_result bridge_p2p_loop(struct ast_channel *c0, struct ast
                } else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
                        if ((fr->subclass == AST_CONTROL_HOLD) ||
                            (fr->subclass == AST_CONTROL_UNHOLD) ||
-                           (fr->subclass == AST_CONTROL_VIDUPDATE)) {
+                           (fr->subclass == AST_CONTROL_VIDUPDATE) ||
+                           (fr->subclass == AST_CONTROL_T38)) {
                                /* If we are going on hold, then break callback mode and P2P bridging */
                                if (fr->subclass == AST_CONTROL_HOLD) {
                                        if (p0_callback)