Module: sems
Branch: master
Commit: 2f618b5ec541da23860819b4cd16829d5354053b
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=2f618b5ec541da23860819b4cd16829d5354053b

Author: Václav Kubart <[email protected]>
Committer: Václav Kubart <[email protected]>
Date:   Tue Jun  4 09:21:40 2013 +0200

b2b calls b/f: handle body in ACK

---

 core/AmB2BSession.cpp |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index 41ed6cb..a46c70a 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -690,6 +690,20 @@ bool AmB2BSession::refresh(int flags) {
 
 int AmB2BSession::relaySip(const AmSipRequest& req)
 {
+  AmMimeBody r_body(req.body);
+  const AmMimeBody* body = &r_body;
+  if (((rtp_relay_mode == RTP_Relay) || (rtp_relay_mode == RTP_Transcoding)) &&
+      (req.method == SIP_METH_INVITE || req.method == SIP_METH_UPDATE ||
+       req.method == SIP_METH_ACK || req.method == SIP_METH_PRACK)) {
+    body = req.body.hasContentType(SIP_APPLICATION_SDP);
+    if (body && updateLocalBody(*body, 
*r_body.hasContentType(SIP_APPLICATION_SDP))) {
+      body = &r_body;
+    }
+    else {
+      body = &req.body;
+    }
+  }
+
   if (req.method != "ACK") {
     relayed_req[dlg->cseq] = req;
 
@@ -714,20 +728,6 @@ int AmB2BSession::relaySip(const AmSipRequest& req)
       }
     }
 
-    AmMimeBody r_body(req.body);
-    const AmMimeBody* body = &r_body;
-    if (((rtp_relay_mode == RTP_Relay) || (rtp_relay_mode == RTP_Transcoding)) 
&&
-        (req.method == SIP_METH_INVITE || req.method == SIP_METH_UPDATE ||
-         req.method == SIP_METH_ACK || req.method == SIP_METH_PRACK)) {
-      body = req.body.hasContentType(SIP_APPLICATION_SDP);
-      if (body && updateLocalBody(*body, 
*r_body.hasContentType(SIP_APPLICATION_SDP))) {
-        body = &r_body;
-      }
-      else {
-        body = &req.body;
-      }
-    }
-
     DBG("relaying SIP request %s %s\n", req.method.c_str(), req.r_uri.c_str());
     int err = dlg->sendRequest(req.method, body, *hdrs, SIP_FLAGS_VERBATIM);
     if(err < 0){
@@ -752,11 +752,12 @@ int AmB2BSession::relaySip(const AmSipRequest& req)
     } 
     if (t == relayed_req.end()) {
       ERROR("transaction for ACK not found in relayed requests\n");
+      // FIXME: local body (if updated) should be discarded here
       return -1;
     }
 
     DBG("sending relayed 200 ACK\n");
-    int err = dlg->send_200_ack(t->first, &req.body, 
+    int err = dlg->send_200_ack(t->first, body, 
                               req.hdrs, SIP_FLAGS_VERBATIM);
     if(err < 0) {
       ERROR("dlg->send_200_ack() failed\n");

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to