Browse code

- simplified some code in the SIP stack - introduced outbound_proxy+force_outbound_proxy at the SIP dialog level (AmSipDialog) - outbound_proxy+force_outbound_proxy is configurable in the sems.conf

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1818 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Raphael Coeffic authored on 22/04/2010 14:27:20
Showing 11 changed files
... ...
@@ -839,14 +839,12 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
839 839
   // get route set and next hop
840 840
   string iptel_app_param = getHeader(req.hdrs, PARAM_HDR);
841 841
   if (iptel_app_param.length()) {
842
-    dlg.setRoute(get_header_keyvalue(iptel_app_param,"Transfer-RR"));
843
-    //dlg.next_hop = get_header_keyvalue(iptel_app_param,"Transfer-NH");
842
+    dlg.route = get_header_keyvalue(iptel_app_param,"Transfer-RR");
844 843
   } else {
845 844
     INFO("Use of P-Transfer-RR/P-Transfer-NH is deprecated. "
846 845
 	 "Use '%s: Transfer-RR=<rr>;Transfer-NH=<nh>' instead.\n",PARAM_HDR);
847 846
 
848
-    dlg.setRoute(getHeader(req.hdrs,"P-Transfer-RR"));
849
-    //dlg.next_hop = getHeader(req.hdrs,"P-Transfer-NH");
847
+    dlg.route = getHeader(req.hdrs,"P-Transfer-RR");
850 848
   }
851 849
 
852 850
   DBG("ConferenceDialog::onSipRequest: local_party = %s\n",dlg.local_party.c_str());
... ...
@@ -57,6 +57,7 @@ int          AmConfig::SIPServerThreads        = NUM_SIP_SERVERS;
57 57
 int          AmConfig::LocalSIPPort            = 5060;
58 58
 string       AmConfig::LocalSIPIP              = "";
59 59
 string       AmConfig::OutboundProxy           = "";
60
+bool         AmConfig::ForceOutboundProxy      = false;
60 61
 string       AmConfig::Signature               = "";
61 62
 bool	     AmConfig::SingleCodecInOK	       = false;
62 63
 unsigned int AmConfig::DeadRtpTime             = DEAD_RTP_TIME;
... ...
@@ -218,6 +219,11 @@ int AmConfig::readConfiguration()
218 219
   
219 220
   // outbound_proxy
220 221
   OutboundProxy = cfg.getParameter("outbound_proxy");
222
+
223
+  // force_outbound_proxy
224
+  if(cfg.hasParameter("force_outbound_proxy")) {
225
+    ForceOutboundProxy = (cfg.getParameter("force_outbound_proxy") == "yes");
226
+  }
221 227
   
222 228
   // plugin_path
223 229
   PlugInPath = cfg.getParameter("plugin_path");
... ...
@@ -87,6 +87,8 @@ struct AmConfig
87 87
   static int LocalSIPPort;
88 88
   /** Outbound Proxy (optional, outgoing calls only) */
89 89
   static string OutboundProxy;
90
+  /** force Outbound Proxy to be used for in dialog requests */
91
+  static bool ForceOutboundProxy;
90 92
   /** Server/User-Agent header (optional) */
91 93
   static string Signature;
92 94
   /** If 200 OK reply should be limited to preferred codec only */
... ...
@@ -41,7 +41,9 @@ const char* AmSipDialog::status2str[4]  = {
41 41
 
42 42
 
43 43
 AmSipDialog::AmSipDialog(AmSipDialogEventHandler* h)
44
-  : status(Disconnected),cseq(10),hdl(h), serKeyLen(0)
44
+  : status(Disconnected),cseq(10),hdl(h),
45
+    outbound_proxy(AmConfig::OutboundProxy),
46
+    force_outbound_proxy(AmConfig::ForceOutboundProxy)
45 47
 {
46 48
 }
47 49
 
... ...
@@ -69,8 +71,7 @@ AmSipDialog::~AmSipDialog()
69 71
 
70 72
 void AmSipDialog::updateStatus(const AmSipRequest& req)
71 73
 {
72
-  if (req.method == "ACK") {
73
-    // || (req.method == "CANCEL")
74
+  if ((req.method == "ACK") || (req.method == "CANCEL")) {
74 75
     return;
75 76
   }
76 77
 
... ...
@@ -102,9 +103,7 @@ void AmSipDialog::updateStatus(const AmSipRequest& req)
102 103
     local_uri    = req.r_uri;
103 104
     remote_party = req.from;
104 105
     local_party  = req.to;
105
-
106
-    setRoute(req.route);
107
-    //next_hop   = req.next_hop;
106
+    route        = req.route;
108 107
   }
109 108
 }
110 109
 
... ...
@@ -145,8 +144,6 @@ int AmSipDialog::updateStatusReply(const AmSipRequest& req, unsigned int code)
145 144
   DBG("reply: transaction found!\n");
146 145
     
147 146
   AmSipTransaction& t = t_it->second;
148
-
149
-  //t->reply_code = code;
150 147
   switch(status){
151 148
 
152 149
   case Disconnected:
... ...
@@ -202,24 +199,21 @@ void AmSipDialog::updateStatus(const AmSipReply& reply, bool do_200_ack)
202 199
   AmSipTransaction& t = t_it->second;
203 200
 
204 201
   // rfc3261 12.1
205
-  // && method==INVITE
206 202
   // Dialog established only by 101-199 or 2xx 
207 203
   // responses to INVITE
208
-  if ((reply.code >= 101) && (reply.code < 300) &&  
209
-      (remote_tag.empty() && !reply.remote_tag.empty()))
210
-    remote_tag = reply.remote_tag;
211 204
 
212
-  if ((reply.code >= 200) && (reply.code < 300) && 
213
-      (status != Connected && !reply.remote_tag.empty()))
205
+  if ( (reply.code > 100) 
206
+       && (reply.code < 300) 
207
+       && !reply.remote_tag.empty() 
208
+       && (remote_tag.empty() ||
209
+	   ((status < Connected) && (reply.code >= 200))) ) {  
210
+
214 211
     remote_tag = reply.remote_tag;
212
+  }
215 213
 
216 214
   // allow route overwritting
217
-  if(status < Connected) {
218
-
219
-    if(!reply.route.empty())
220
-      setRoute(reply.route);
221
-
222
-    //next_hop = reply.next_hop;
215
+  if ((status < Connected) && !reply.route.empty()) {
216
+      route = reply.route;
223 217
   }
224 218
 
225 219
   if (reply.next_request_uri.length())
... ...
@@ -491,7 +485,7 @@ int AmSipDialog::transfer(const string& target)
491 485
     string      hdrs = "";
492 486
     AmSipDialog tmp_d(*this);
493 487
 		
494
-    tmp_d.setRoute("");
488
+    tmp_d.route = "";
495 489
     tmp_d.contact_uri = SIP_HDR_COLSP(SIP_HDR_CONTACT) 
496 490
       "<" + tmp_d.remote_uri + ">" CRLF;
497 491
     tmp_d.remote_uri = target;
... ...
@@ -499,14 +493,7 @@ int AmSipDialog::transfer(const string& target)
499 493
     string r_set;
500 494
     if(!route.empty()){
501 495
 			
502
-      vector<string>::iterator it = route.begin();
503
-      r_set ="Transfer-RR=\"" + *it;
504
-			
505
-      for(it++; it != route.end(); it++)
506
-	r_set += "," + *it;
507
-			
508
-      r_set += "\"";
509
-      hdrs = PARAM_HDR ": " + r_set;
496
+      hdrs = PARAM_HDR ": " "Transfer-RR=\"" + route + "\"";
510 497
     }
511 498
 				
512 499
     int ret = tmp_d.sendRequest("REFER","","",hdrs);
... ...
@@ -527,22 +514,12 @@ int AmSipDialog::transfer(const string& target)
527 514
 
528 515
 int AmSipDialog::cancel()
529 516
 {
530
-    
531
-    
532 517
     for(TransMap::reverse_iterator t = uac_trans.rbegin();
533 518
 	t != uac_trans.rend(); t++) {
534 519
 	
535 520
 	if(t->second.method == "INVITE"){
536
-	    
537
-	    AmSipRequest req;
538
-	    
539
-	    req.method = "CANCEL";
540
-	    req.callid = callid;
541
-	    req.cseq = t->second.cseq;
542
-
543
-	    req.tt = t->second.tt;
544
-
545
-	    return SipCtrlInterface::send(req) ? 0 : -1;
521
+	  
522
+	  return SipCtrlInterface::cancel(&t->second.tt);
546 523
 	}
547 524
     }
548 525
     
... ...
@@ -566,7 +543,6 @@ int AmSipDialog::sendRequest(const string& method,
566 543
 
567 544
   req.method = method;
568 545
   req.r_uri = remote_uri;
569
-  //req.next_hop = next_hop;
570 546
 
571 547
   req.from = SIP_HDR_COLSP(SIP_HDR_FROM) + local_party;
572 548
   if(!local_tag.empty())
... ...
@@ -590,13 +566,22 @@ int AmSipDialog::sendRequest(const string& method,
590 566
     if (AmConfig::Signature.length())
591 567
       req.hdrs += SIP_HDR_COLSP(SIP_HDR_USER_AGENT) + AmConfig::Signature + CRLF;
592 568
     
593
-    req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) /*TODO: configurable?!*/MAX_FORWARDS CRLF;
569
+    req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) /*TODO: configurable?!*/ MAX_FORWARDS CRLF;
594 570
 
595 571
   }
596 572
 
597
-  if(!route.empty())
598
-    req.route = getRoute();
599
-    
573
+  if(!route.empty()) {
574
+
575
+    req.route = "Route: ";
576
+    if(force_outbound_proxy){
577
+      req.route += "<" + outbound_proxy + ";lr>, ";
578
+    }
579
+    req.route += route + CRLF;
580
+  }
581
+  else if (remote_tag.empty() && !outbound_proxy.empty()) {
582
+    req.route = "Route: <" + outbound_proxy + ";lr>" CRLF;
583
+  }
584
+
600 585
   if(!body.empty()) {
601 586
     req.content_type = content_type;
602 587
     req.body = body;
... ...
@@ -613,17 +598,6 @@ int AmSipDialog::sendRequest(const string& method,
613 598
   return 0;
614 599
 }
615 600
 
616
-
617
-// bool AmSipDialog::match_cancel(const AmSipRequest& cancel_req)
618
-// {
619
-//   TransMap::iterator t = uas_trans.find(cancel_req.cseq);
620
-
621
-//   if((t != uas_trans.end()) && (t->second.method == "INVITE"))
622
-//     return true;
623
-
624
-//   return false;
625
-// }
626
-
627 601
 string AmSipDialog::get_uac_trans_method(unsigned int cseq)
628 602
 {
629 603
   TransMap::iterator t = uac_trans.find(cseq);
... ...
@@ -634,39 +608,6 @@ string AmSipDialog::get_uac_trans_method(unsigned int cseq)
634 608
   return "";
635 609
 }
636 610
 
637
-string AmSipDialog::getRoute()
638
-{
639
-  string r_set("");
640
-  for(vector<string>::iterator it = route.begin();
641
-      it != route.end(); it++) {
642
-    r_set += SIP_HDR_COLSP(SIP_HDR_ROUTE) + *it + CRLF;
643
-  }
644
-
645
-  return r_set;
646
-}
647
-
648
-void AmSipDialog::setRoute(const string& n_route)
649
-{
650
-  string m_route = n_route;
651
-  if(!m_route.empty() && (m_route.find("Route: ")!=string::npos))
652
-    m_route = m_route.substr(7/*sizeof("Route: ")*/);
653
-    
654
-  route.clear();
655
-  while(!m_route.empty()){
656
-	
657
-    string::size_type comma_pos;
658
-	
659
-    comma_pos = m_route.find(',');
660
-    //route += "Route: " + m_route.substr(0,comma_pos) + "\r\n";
661
-    route.push_back(m_route.substr(0,comma_pos));
662
-	
663
-    if(comma_pos != string::npos)
664
-      m_route = m_route.substr(comma_pos+1);
665
-    else
666
-      m_route = "";
667
-  }
668
-}
669
-
670 611
 int AmSipDialog::drop()
671 612
 {	
672 613
   status = Disconnected;
... ...
@@ -722,7 +663,7 @@ int AmSipDialog::send_200_ack(const AmSipTransaction& t,
722 663
   }
723 664
 
724 665
   if(!route.empty())
725
-    req.route = getRoute();
666
+    req.route = route; //getRoute();
726 667
     
727 668
   if(!body.empty()) {
728 669
     req.content_type = content_type;
... ...
@@ -100,7 +100,6 @@ class AmSipDialog
100 100
   TransMap uac_trans;
101 101
 
102 102
   AmSipDialogEventHandler* hdl;
103
-  std::vector<string> route;        // record routing
104 103
 
105 104
   int updateStatusReply(const AmSipRequest& req, 
106 105
 			unsigned int code);
... ...
@@ -133,15 +132,11 @@ class AmSipDialog
133 132
   string remote_party; // To/From
134 133
   string local_party;  // To/From
135 134
 
136
-  string getRoute(); // record routing
137
-  void   setRoute(const string& n_route);
135
+  string route;
136
+  string outbound_proxy;
137
+  bool   force_outbound_proxy;
138 138
 
139
-  //string next_hop;     // next_hop for t_uac_dlg
140
-
141
-  int cseq;            // CSeq for next request
142
-
143
-  char serKey[MAX_SER_KEY_LEN];      // opaque string returned by SER, when staring a T
144
-  unsigned int serKeyLen;
139
+  int    cseq; // Local CSeq for next request
145 140
 
146 141
   AmSipDialog(AmSipDialogEventHandler* h=0);
147 142
   ~AmSipDialog();
... ...
@@ -152,10 +147,11 @@ class AmSipDialog
152 147
 
153 148
   void updateStatus(const AmSipRequest& req);
154 149
   void updateStatus(const AmSipReply& reply, bool do_200_ack=true);
150
+
155 151
   /** update Status from locally originated request (e.g. INVITE) */
156 152
   void updateStatusFromLocalRequest(const AmSipRequest& req);
157 153
 
158
-  int reply(const AmSipRequest& req, // Ser's transaction key
154
+  int reply(const AmSipRequest& req,
159 155
 	    unsigned int  code, 
160 156
 	    const string& reason,
161 157
 	    const string& content_type = "",
... ...
@@ -189,12 +185,6 @@ class AmSipDialog
189 185
   int transfer(const string& target);
190 186
   int drop();
191 187
 
192
-  /**
193
-   * @return true if a transaction could be found that
194
-   *              matches the CANCEL's one.
195
-   */
196
-  //bool match_cancel(const AmSipRequest& cancel_req);
197
-
198 188
   /**
199 189
    * @return the method of the corresponding uac request
200 190
    */
... ...
@@ -11,7 +11,6 @@ class _AmSipMsgInDlg
11 11
 {
12 12
   public:
13 13
     string       method;
14
-    //string       next_hop; // URI
15 14
     string       route;
16 15
 
17 16
     string       contact;
... ...
@@ -127,16 +127,15 @@ SipCtrlInterface::SipCtrlInterface()
127 127
     trans_layer::instance()->register_ua(this);
128 128
 }
129 129
 
130
-int SipCtrlInterface::cancel(AmSipRequest& req)
130
+int SipCtrlInterface::cancel(trans_ticket* tt)
131 131
 {
132
-    return trans_layer::instance()->cancel(&req.tt);
132
+    return trans_layer::instance()->cancel(tt);
133 133
 }
134 134
 
135
-
136 135
 int SipCtrlInterface::send(AmSipRequest &req)
137 136
 {
138 137
     if(req.method == "CANCEL")
139
-	return cancel(req);
138
+	return cancel(&req.tt);
140 139
 
141 140
     sip_msg* msg = new sip_msg();
142 141
     
... ...
@@ -152,7 +151,6 @@ int SipCtrlInterface::send(AmSipRequest &req)
152 151
     // CSeq
153 152
     // Contact
154 153
     // Max-Forwards
155
-
156 154
     
157 155
     char* c = (char*)req.from.c_str();
158 156
     int err = parse_headers(msg,&c);
... ...
@@ -175,7 +173,6 @@ int SipCtrlInterface::send(AmSipRequest &req)
175 173
     msg->callid = new sip_header(0,"Call-ID",stl2cstr(req.callid));
176 174
     msg->hdrs.push_back(msg->callid);
177 175
 
178
-
179 176
     if(!req.contact.empty()){
180 177
 
181 178
 	c = (char*)req.contact.c_str();
... ...
@@ -189,9 +186,8 @@ int SipCtrlInterface::send(AmSipRequest &req)
189 186
     
190 187
     if(!req.route.empty()){
191 188
 	
192
- 	char *c = (char*)req.route.c_str();
193
-	
194
- 	err = parse_headers(msg,&c);
189
+ 	c = (char*)req.route.c_str();
190
+	err = parse_headers(msg,&c);
195 191
 	
196 192
 	if(err){
197 193
 	    ERROR("Route headers parsing failed\n");
... ...
@@ -199,27 +195,11 @@ int SipCtrlInterface::send(AmSipRequest &req)
199 195
 	    delete msg;
200 196
 	    return -1;
201 197
 	}
202
-
203
-	//
204
-	// parse_headers() appends our route headers 
205
-	// to msg->hdrs and msg->route. But we want
206
-	// only msg->route(), so we just remove the
207
-	// route headers at the end of msg->hdrs.
208
-	//
209
- 	for(sip_header* h_rr = msg->hdrs.back();
210
- 	    !msg->hdrs.empty(); h_rr = msg->hdrs.back()) {
211
-	    
212
- 	    if(h_rr->type != sip_header::H_ROUTE){
213
- 		break;
214
- 	    }
215
-	    
216
-	    msg->hdrs.pop_back();
217
- 	}
218 198
     }
219 199
 
220 200
     if(!req.hdrs.empty()) {
221 201
 	
222
- 	char *c = (char*)req.hdrs.c_str();
202
+ 	c = (char*)req.hdrs.c_str();
223 203
 	
224 204
  	err = parse_headers(msg,&c);
225 205
 	
... ...
@@ -244,41 +224,6 @@ int SipCtrlInterface::send(AmSipRequest &req)
244 224
 	}
245 225
     }
246 226
 
247
-    string next_hop;
248
-    unsigned int next_port_i = 0;
249
-
250
-//     if(!req.next_hop.empty()){
251
-// 	string next_port;
252
-// 	sip_uri parsed_uri;
253
-// 	if (parse_uri(&parsed_uri, (char *)req.next_hop.c_str(),
254
-// 		      req.next_hop.length()) < 0) {
255
-// 	    ERROR("invalid next hop URI '%s'\n", req.next_hop.c_str());
256
-// 	    ERROR("Using default outbound proxy");
257
-// 	    next_hop = SipCtrlInterface::outbound_host;
258
-// 	    next_port_i = SipCtrlInterface::outbound_port;
259
-// 	} else {
260
-// 	    next_hop = c2stlstr(parsed_uri.host);
261
-// 	    if (parsed_uri.port) {
262
-// 		next_port_i= parsed_uri.port;	    }
263
-// 	    next_hop += *(c++);
264
-// 	}
265
-//     }
266
-//    else 
267
-    if(!SipCtrlInterface::outbound_host.empty()){
268
-	next_hop = SipCtrlInterface::outbound_host;
269
-	next_port_i = SipCtrlInterface::outbound_port;
270
-    }
271
-
272
-    cstring c_next_hop = stl2cstr(next_hop);
273
-    if(trans_layer::instance()->set_next_hop(msg->route,msg->u.request->ruri_str,
274
-			c_next_hop,(unsigned short)next_port_i,
275
-			&msg->remote_ip) < 0){
276
-
277
-	DBG("set_next_hop failed\n");
278
-	delete msg;
279
-	return -1;
280
-    }
281
-
282 227
     int res = trans_layer::instance()->send_request(msg,&req.tt);
283 228
     delete msg;
284 229
 
... ...
@@ -38,17 +38,16 @@ using std::list;
38 38
 class AmSipRequest;
39 39
 class AmSipReply;
40 40
 
41
-class trans_layer;
42
-class trans_bucket;
43 41
 struct sip_msg;
44 42
 struct sip_header;
43
+class trans_ticket;
44
+
45 45
 
46 46
 class SipCtrlInterface:
47 47
     public sip_ua
48 48
 {
49 49
     void prepare_routes_uac(const list<sip_header*>& routes, string& route_field);
50 50
     void prepare_routes_uas(const list<sip_header*>& routes, string& route_field);
51
-    static int cancel(AmSipRequest& req);
52 51
 
53 52
     friend class udp_trsp;
54 53
 
... ...
@@ -68,10 +67,9 @@ public:
68 67
 
69 68
     void run(const string& bind_addr, unsigned short bind_port);
70 69
     
71
-    /**
72
-     * From AmCtrlInterface
73
-     */
74 70
     static int send(AmSipRequest &req);
71
+    static int cancel(trans_ticket* tt);
72
+
75 73
     static int send(const AmSipReply &rep);
76 74
     
77 75
     /**
... ...
@@ -282,8 +282,6 @@ int parse_headers(sip_msg* msg, char** c)
282 282
     int saved_st = 0;
283 283
 
284 284
     char* begin = *c;
285
-    //bool  cr = false;
286
-
287 285
     auto_ptr<sip_header> hdr(new sip_header());
288 286
 
289 287
     for(;**c;(*c)++){
... ...
@@ -539,7 +539,7 @@ int trans_layer::send_sl_reply(sip_msg* req, int reply_code,
539 539
 //
540 540
 int trans_layer::set_next_hop(list<sip_header*>& route_hdrs, 
541 541
 			      cstring& r_uri, cstring& next_hop,
542
-			      unsigned short next_port,
542
+			      unsigned short& next_port,
543 543
 			      sockaddr_storage* remote_ip)
544 544
 {
545 545
     int err=0;
... ...
@@ -648,7 +648,7 @@ int trans_layer::set_next_hop(list<sip_header*>& route_hdrs,
648 648
 	    case RR_PARAMS:
649 649
 		// remove current route header from message
650 650
 		DBG("delete (fr=0x%p)\n",fr);
651
-		delete fr; // route_hdrs.front();
651
+		delete fr;
652 652
 		route_hdrs.pop_front();
653 653
 		DBG("route_hdrs.length() = %i\n",(int)route_hdrs.size());
654 654
 		break;
... ...
@@ -669,7 +669,8 @@ int trans_layer::set_next_hop(list<sip_header*>& route_hdrs,
669 669
 	}
670 670
 	
671 671
     }
672
-    else if (next_hop.len == 0) {
672
+    else {
673
+
673 674
 	sip_uri parsed_r_uri;
674 675
 	err = parse_uri(&parsed_r_uri,r_uri.s,r_uri.len);
675 676
 	if(err < 0){
... ...
@@ -730,17 +731,26 @@ int trans_layer::send_request(sip_msg* msg, trans_ticket* tt)
730 731
     // Contact
731 732
     // Supported / Require
732 733
     // Content-Length / Content-Type
733
-    
734
+
734 735
     assert(transport);
735 736
     assert(msg);
736 737
     assert(tt);
737 738
 
739
+    cstring        next_hop;
740
+    unsigned short next_port = 0;
741
+
738 742
     tt->_bucket = 0;
739 743
     tt->_t = 0;
740 744
 
741
-    // assume that msg->route headers are not in msg->hdrs
742
-    msg->hdrs.insert(msg->hdrs.begin(),msg->route.begin(),msg->route.end());
745
+    if(trans_layer::instance()->set_next_hop(msg->route,msg->u.request->ruri_str,
746
+			next_hop,next_port,
747
+			&msg->remote_ip) < 0){
743 748
 
749
+	DBG("set_next_hop failed\n");
750
+	delete msg;
751
+	return -1;
752
+    }
753
+    
744 754
     int request_len = request_line_len(msg->u.request->method_str,
745 755
 				       msg->u.request->ruri_str);
746 756
 
... ...
@@ -1036,7 +1046,7 @@ void trans_layer::received_msg(sip_msg* msg)
1036 1046
 	    }
1037 1047
 	    else {
1038 1048
 		DBG("Found retransmission\n");
1039
-		retransmit(t);
1049
+		retransmit(t); // retransmit reply
1040 1050
 	    }
1041 1051
 	}
1042 1052
 	else {
... ...
@@ -97,12 +97,12 @@ class trans_layer
97 97
     int update_uas_reply(trans_bucket* bucket, sip_trans* t, int reply_code);
98 98
 
99 99
     /**
100
-     * Retransmits reply / non-200 ACK (if possible).
100
+     * Retransmits the content of the retry buffer (replies or non-200 ACK).
101 101
      */
102 102
     void retransmit(sip_trans* t);
103 103
 
104 104
     /**
105
-     * Retransmits a message (mostly the first UAC request).
105
+     * Retransmits a message (UAC requests).
106 106
      */
107 107
     void retransmit(sip_msg* msg);
108 108
 
... ...
@@ -120,6 +120,14 @@ class trans_layer
120 120
     int send_sl_reply(sip_msg* req, int reply_code, 
121 121
 		      const cstring& reason, 
122 122
 		      const cstring& hdrs, const cstring& body);
123
+
124
+    /**
125
+     * Fills the address structure passed and modifies 
126
+     * R-URI and Route headers as needed.
127
+     */
128
+    int set_next_hop(list<sip_header*>& route_hdrs, cstring& r_uri, 
129
+		     cstring& next_hop, unsigned short& next_port,
130
+		     sockaddr_storage* remote_ip);
123 131
     
124 132
     /**
125 133
      * Transaction timeout
... ...
@@ -179,14 +187,6 @@ class trans_layer
179 187
      */
180 188
     void received_msg(sip_msg* msg);
181 189
 
182
-    /**
183
-     * Fills the address structure passed and modifies 
184
-     * R-URI and Route headers as needed.
185
-     */
186
-    int set_next_hop(list<sip_header*>& route_hdrs, cstring& r_uri, 
187
-		     cstring& next_hop, unsigned short next_port,
188
-		     sockaddr_storage* remote_ip);
189
-
190 190
     /**
191 191
      * This is called by the transaction timer callback.
192 192
      * At this place, the bucket is already locked, so