Browse code

core: set transport when updating next-hop

Raphael Coeffic authored on 18/11/2013 13:49:48
Showing 2 changed files
... ...
@@ -325,8 +325,10 @@ void AmBasicSipDialog::onRxRequest(const AmSipRequest& req)
325 325
     if (remote_uri != req.from_uri) {
326 326
       setRemoteUri(req.from_uri);
327 327
       if(nat_handling && req.first_hop) {
328
-	setNextHop(req.remote_ip + ":"
329
-		   + int2str(req.remote_port));
328
+	string nh = req.remote_ip + ":"
329
+	  + int2str(req.remote_port)
330
+	  + "/" + req.trsp;
331
+	setNextHop(nh);
330 332
 	setNextHop1stReq(false);
331 333
       }
332 334
     }
... ...
@@ -470,8 +472,10 @@ void AmBasicSipDialog::updateDialogTarget(const AmSipReply& reply)
470 472
     
471 473
     setRemoteUri(reply.to_uri);
472 474
     if(!getNextHop().empty()) {
473
-      setNextHop(reply.remote_ip + ":"
474
-		 + int2str(reply.remote_port));
475
+      string nh = reply.remote_ip 
476
+	+ ":" + int2str(reply.remote_port)
477
+	+ "/" + reply.trsp;
478
+      setNextHop(nh);
475 479
     }
476 480
 
477 481
     string ua = getHeader(reply.hdrs,"Server");
... ...
@@ -737,6 +737,9 @@ inline bool _SipCtrlInterface::sip_msg2am_reply(sip_msg *msg, AmSipReply &reply)
737 737
     reply.local_ip = get_addr_str(&msg->local_ip);
738 738
     reply.local_port = am_get_port(&msg->local_ip);
739 739
 
740
+    if(msg->local_socket)
741
+	reply.trsp = msg->local_socket->get_transport();
742
+
740 743
     return true;
741 744
 }
742 745