]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
MODSOFIA-17
authorBrian West <brian@freeswitch.org>
Tue, 14 Jul 2009 19:49:34 +0000 (19:49 +0000)
committerBrian West <brian@freeswitch.org>
Tue, 14 Jul 2009 19:49:34 +0000 (19:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14251 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index b4628e1b7624c2c2677ded31726be48db72e1517..7a272d4d51bb25fdf1c3e988b9e75cd545e96eeb 100644 (file)
@@ -4856,13 +4856,16 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                        }
 
                        if (url) {
-                               if (strchr(url, '>')) {
-                                       tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url,
-                                                                                                                                                 sofia_glue_transport2str(transport));
-                               } else {
-                                       tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url,
-                                                                                                                                                 sofia_glue_transport2str(transport));
-                               }
+                               const char *brackets = NULL;
+                               const char *proto = NULL;
+                               
+                               brackets = strchr(url, '>');
+                               proto = switch_stristr("transport=", url);
+                               tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s%s%s%s%s",
+                                                                                                                                         brackets ? "" : "<", url,
+                                                                                                                                         proto ? "" : ";transport=",
+                                                                                                                                         proto ? "" : sofia_glue_transport2str(transport),
+                                                                                                                                         brackets ? "" : ">");
                        } else {
                                switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        }
@@ -4876,13 +4879,16 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                        }                       
                        
                        if (url) {
-                               if (strchr(url, '>')) {
-                                       tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url,
-                                                                                                                                                 sofia_glue_transport2str(transport));
-                               } else {
-                                       tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url,
-                                                                                                                                                 sofia_glue_transport2str(transport));
-                               }
+                               const char *brackets = NULL;
+                               const char *proto = NULL;
+                               
+                               brackets = strchr(url, '>');
+                               proto = switch_stristr("transport=", url);
+                               tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s%s%s%s%s",
+                                                                                                                                         brackets ? "" : "<", url,
+                                                                                                                                         proto ? "" : ";transport=",
+                                                                                                                                         proto ? "" : sofia_glue_transport2str(transport),
+                                                                                                                                         brackets ? "" : ">");
                        } else {
                                switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        }