path = sofia_glue_get_path_from_contact((char *) o_contact);
}
- tmp = (char *)o_contact;
- o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1);
+ dst = sofia_glue_get_destination((char *) o_contact);
+ switch_assert(dst);
+ if (!zstr(dst->contact)) {
+ contact = sofia_glue_get_url_from_contact(dst->contact, 1);
+ } else {
+ contact = strdup(o_contact);
+ }
+
+ if (dst->route_uri) {
+ route_uri = sofia_glue_strip_uri(dst->route_uri);
+ tmp = (char *)route_uri;
+ } else {
+ tmp = (char *)o_contact;
+ }
+
+ o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1);
if ((tp = switch_stristr("transport=", o_contact_dup))) {
tp += 10;
free(to_uri);
}
- dst = sofia_glue_get_destination((char *) o_contact);
- switch_assert(dst);
-
- if (!zstr(dst->contact)) {
- contact = sofia_glue_get_url_from_contact(dst->contact, 1);
- } else {
- contact = strdup(o_contact);
- }
-
- if (dst->route_uri) {
- route_uri = sofia_glue_strip_uri(dst->route_uri);
- }
-
if (expires) {
long ltmp = atol(expires);
char *sticky = NULL;
char *contactstr = profile->url, *cs = NULL;
char *p = NULL, *new_contactstr = NULL;
-
+ sofia_transport_t transport;
if (np.is_nat) {
char params[128] = "";
contactstr = profile->url;
}
+ if (sip->sip_via) {
+ transport = sofia_glue_via2transport(sip->sip_via);
+ } else {
+ transport = sofia_glue_url2transport(contact->m_url);
+ }
- if (switch_stristr("port=tcp", contact->m_url->url_params)) {
+ if (transport == SOFIA_TRANSPORT_TCP) {
if (np.is_auto_nat) {
cs = profile->tcp_public_contact;
} else {
cs = profile->tcp_contact;
}
- } else if (switch_stristr("port=tls", contact->m_url->url_params)) {
+ } else if (transport == SOFIA_TRANSPORT_TCP_TLS) {
if (np.is_auto_nat) {
- cs = sofia_test_pflag(profile, PFLAG_TLS) ?
- profile->tls_public_contact : profile->tcp_public_contact;
+ cs = sofia_test_pflag(profile, PFLAG_TLS) ? profile->tls_public_contact : profile->tcp_public_contact;
} else {
- cs = sofia_test_pflag(profile, PFLAG_TLS) ?
- profile->tls_contact : profile->tcp_contact;
+ cs = sofia_test_pflag(profile, PFLAG_TLS) ? profile->tls_contact : profile->tcp_contact;
}
}