Module: sems
Branch: rco/dnscache
Commit: 8e77f34e55541c179c9b94fae5a7853c3a565364
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=8e77f34e55541c179c9b94fae5a7853c3a565364

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Tue Aug 31 18:51:20 2010 +0200

fixes retransmission to another ip

- start the retransmission itself
- reset timer A/E correctly

---

 apps/sst_b2b/SSTB2B.cpp  |    2 ++
 core/sip/trans_layer.cpp |   24 +++++++++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/apps/sst_b2b/SSTB2B.cpp b/apps/sst_b2b/SSTB2B.cpp
index c86217a..bd8425c 100644
--- a/apps/sst_b2b/SSTB2B.cpp
+++ b/apps/sst_b2b/SSTB2B.cpp
@@ -34,6 +34,7 @@
 #include "AmMediaProcessor.h"
 #include "AmConfigReader.h"
 #include "AmSessionContainer.h"
+#include "AmSipHeaders.h"
 
 string SSTB2BFactory::user;
 string SSTB2BFactory::domain;
@@ -131,6 +132,7 @@ void SSTB2BDialog::onInvite(const AmSipRequest& req)
   recvd_req.insert(std::make_pair(req.cseq,req));
   
   set_sip_relay_only(true);
+  DBG("##### connecting to <%s>",req.r_uri.c_str());
   connectCallee("<" + req.r_uri + ">", req.r_uri, true);
 }
 
diff --git a/core/sip/trans_layer.cpp b/core/sip/trans_layer.cpp
index 4abaab5..087b593 100644
--- a/core/sip/trans_layer.cpp
+++ b/core/sip/trans_layer.cpp
@@ -745,9 +745,22 @@ int _trans_layer::send_request(sip_msg* msg, trans_ticket* 
tt)
     assert(msg);
     assert(tt);
 
+    cstring next_hop;
+    unsigned short next_port=0;
+
     tt->_bucket = 0;
     tt->_t = 0;
 
+    if(!msg->u.request->ruri_str.len ||
+       !msg->u.request->method_str.len) {
+       
+       ERROR("empty method name or R-URI");
+       return -1;
+    }
+    else {
+       DBG("send_request to 
<%.*s>",msg->u.request->ruri_str.len,msg->u.request->ruri_str.s);
+    }
+
     int request_len = request_line_len(msg->u.request->method_str,
                                       msg->u.request->ruri_str);
 
@@ -807,10 +820,7 @@ int _trans_layer::send_request(sip_msg* msg, trans_ticket* 
tt)
        return MALFORMED_SIP_MSG;
     }
 
-    cstring next_hop;
-    unsigned short next_port=0;
-
-    if(set_next_hop(p_msg,&next_hop,&next_port) < 0){
+    if(set_next_hop(msg,&next_hop,&next_port) < 0){
        DBG("set_next_hop failed\n");
        delete p_msg;
        return -1;
@@ -1686,6 +1696,8 @@ void _trans_layer::timer_expired(timer* t, trans_bucket* 
bucket, sip_trans* tr)
            sockaddr_storage sa;
            memset(&sa,0,sizeof(sockaddr_storage));
 
+           //TODO: get the right port number 
+           
            // get the next ip
            if(tr->msg->h_dns.next_ip(&sa) < 0){
                tr->clear_timer(STIMER_M);
@@ -1697,9 +1709,11 @@ void _trans_layer::timer_expired(timer* t, trans_bucket* 
bucket, sip_trans* tr)
            compute_branch((char*)(tr->msg->via_p1->branch.s+MAGIC_BRANCH_LEN),
                           tr->msg->callid->value,tr->msg->cseq->value);
 
+           retransmit(tr->msg);
+
            // reset counter for timer A & E
            timer* A_E_timer = tr->get_timer(STIMER_A);
-           tr->reset_timer(A_E_timer->type,A_TIMER,bucket->get_id());
+           tr->reset_timer(A_E_timer->type & 0xFFFF,A_TIMER,bucket->get_id());
 
            if(!tr->msg->h_dns.eoip())
                tr->reset_timer(STIMER_M,M_TIMER,bucket->get_id());

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

Reply via email to