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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Thu Jan 20 13:09:03 2011 +0100

b/f: use outbound_proxy for 200 ACK, too

---

 core/AmSipDialog.cpp |   35 +++++++++++++++++++++--------------
 core/AmSipDialog.h   |    2 ++
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index 464c3b1..cf9b3dc 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -509,6 +509,25 @@ string AmSipDialog::getContactHdr()
   return contact_uri;
 }
 
+string AmSipDialog::getRoute() {
+  string res;
+
+  if(!route.empty() || (force_outbound_proxy && !outbound_proxy.empty())) {
+    res = SIP_HDR_COLSP(SIP_HDR_ROUTE);
+
+    if(force_outbound_proxy && !outbound_proxy.empty())
+      res += "<" + outbound_proxy + ";lr>, ";
+
+    if (!route.empty())
+      res += route;
+
+    route += CRLF;
+  }
+
+  return res;
+}
+
+
 int AmSipDialog::reply(const AmSipRequest& req,
                       unsigned int  code,
                       const string& reason,
@@ -861,17 +880,7 @@ int AmSipDialog::sendRequest(const string& method,
 
   }
 
-  if(!route.empty()) {
-
-    req.route = SIP_HDR_COLSP(SIP_HDR_ROUTE);
-    if(force_outbound_proxy && !outbound_proxy.empty()){
-      req.route += "<" + outbound_proxy + ";lr>, ";
-    }
-    req.route += route + CRLF;
-  }
-  else if (remote_tag.empty() && !outbound_proxy.empty()) {
-    req.route = SIP_HDR_COLSP(SIP_HDR_ROUTE) "<" + outbound_proxy + ";lr>" 
CRLF;
-  }
+  req.route = getRoute();
 
   if(!body.empty()) {
     req.content_type = content_type;
@@ -984,9 +993,7 @@ int AmSipDialog::send_200_ack(const AmSipTransaction& t,
     req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) + 
int2str(AmConfig::MaxForwards) + CRLF;
   }
 
-  if(!route.empty()) {
-    req.route = SIP_HDR_COLSP(SIP_HDR_ROUTE) + route + CRLF;
-  }
+  req.route = getRoute();
 
   if(!body.empty()) {
     req.content_type = content_type;
diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h
index c741f21..4bda299 100644
--- a/core/AmSipDialog.h
+++ b/core/AmSipDialog.h
@@ -136,6 +136,8 @@ class AmSipDialog
   int updateStatusReply(const AmSipRequest& req, 
                        unsigned int code);
 
+  string getRoute();
+
   int rel100OnRequestIn(const AmSipRequest &req);
   int rel100OnReplyIn(const AmSipReply &reply);
   void rel100OnTimeout(const AmSipRequest &req, const AmSipReply &rpl);

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

Reply via email to