Browse code

Improvement: Add option not to add ";transport=" to contact

Carsten Bock authored on 20/08/2014 08:10:33
Showing 3 changed files
... ...
@@ -761,8 +761,9 @@ static int readSIPInterface(AmConfigReader& cfg, const string& i_name)
761 761
 	it_opt != opt_strs.end(); ++it_opt) {
762 762
       if(*it_opt == "force_via_address") {
763 763
 	opts |= trsp_socket::force_via_address;
764
-      }
765
-      else {
764
+      } else if(*it_opt == "no_transport_in_contact") {
765
+	opts |= trsp_socket::no_transport_in_contact;
766
+      } else {
766 767
 	WARN("unknown signaling socket option '%s' set on interface '%s'\n",
767 768
 	     it_opt->c_str(),i_name.c_str());
768 769
       }
... ...
@@ -268,16 +268,18 @@ int _trans_layer::send_reply(sip_msg* msg, const trans_ticket* tt,
268 268
     assert(req);
269 269
 
270 270
     trsp_socket* local_socket = req->local_socket;
271
-    cstring trsp(local_socket->get_transport());
271
+    if(!local_socket->is_opt_set(trsp_socket::no_transport_in_contact)) {
272
+	    cstring trsp(local_socket->get_transport());
272 273
 
273
-    // patch Contact-HF
274
-    vector<string> contact_buf(msg->contacts.size());
275
-    vector<string>::iterator contact_buf_it = contact_buf.begin();
274
+	    // patch Contact-HF
275
+	    vector<string> contact_buf(msg->contacts.size());
276
+	    vector<string>::iterator contact_buf_it = contact_buf.begin();
276 277
 
277
-    for(list<sip_header*>::iterator contact_it = msg->contacts.begin();
278
-	contact_it != msg->contacts.end(); contact_it++, contact_buf_it++) {
278
+	    for(list<sip_header*>::iterator contact_it = msg->contacts.begin();
279
+		contact_it != msg->contacts.end(); contact_it++, contact_buf_it++) {
279 280
 	
280
-	patch_contact_transport(*contact_it,trsp,*contact_buf_it);
281
+		patch_contact_transport(*contact_it,trsp,*contact_buf_it);
282
+	    }
281 283
     }
282 284
     
283 285
     bool have_to_tag = false;
... ...
@@ -44,9 +44,10 @@ class trsp_socket
44 44
 {
45 45
 public:
46 46
     enum socket_options {
47
-	force_via_address = (1 << 0),
48
-	force_outbound_if = (1 << 1),
49
-	use_raw_sockets   = (1 << 2)
47
+	force_via_address       = (1 << 0),
48
+	force_outbound_if       = (1 << 1),
49
+	use_raw_sockets         = (1 << 2),
50
+	no_transport_in_contact = (1 << 3)
50 51
     };
51 52
 
52 53
     static int log_level_raw_msgs;