FS-7407: when using proxy, make sure to pick the right transport to the proxy

This commit is contained in:
Michael Jerris 2015-04-13 22:54:02 +00:00 committed by root
parent 535cfbbd4f
commit 3bbfa9f341
1 changed files with 26 additions and 22 deletions

View File

@ -2201,9 +2201,23 @@ static void _send_presence_notify(sofia_profile_t *profile,
path = sofia_glue_get_path_from_contact((char *) o_contact); path = sofia_glue_get_path_from_contact((char *) o_contact);
} }
tmp = (char *)o_contact; dst = sofia_glue_get_destination((char *) o_contact);
o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1); 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))) { if ((tp = switch_stristr("transport=", o_contact_dup))) {
tp += 10; tp += 10;
@ -2272,19 +2286,6 @@ static void _send_presence_notify(sofia_profile_t *profile,
free(to_uri); 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) { if (expires) {
long ltmp = atol(expires); long ltmp = atol(expires);
@ -4023,7 +4024,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
char *sticky = NULL; char *sticky = NULL;
char *contactstr = profile->url, *cs = NULL; char *contactstr = profile->url, *cs = NULL;
char *p = NULL, *new_contactstr = NULL; char *p = NULL, *new_contactstr = NULL;
sofia_transport_t transport;
if (np.is_nat) { if (np.is_nat) {
char params[128] = ""; char params[128] = "";
@ -4040,20 +4041,23 @@ void sofia_presence_handle_sip_i_subscribe(int status,
contactstr = profile->url; 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) { if (np.is_auto_nat) {
cs = profile->tcp_public_contact; cs = profile->tcp_public_contact;
} else { } else {
cs = profile->tcp_contact; 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) { if (np.is_auto_nat) {
cs = sofia_test_pflag(profile, PFLAG_TLS) ? cs = sofia_test_pflag(profile, PFLAG_TLS) ? profile->tls_public_contact : profile->tcp_public_contact;
profile->tls_public_contact : profile->tcp_public_contact;
} else { } else {
cs = sofia_test_pflag(profile, PFLAG_TLS) ? cs = sofia_test_pflag(profile, PFLAG_TLS) ? profile->tls_contact : profile->tcp_contact;
profile->tls_contact : profile->tcp_contact;
} }
} }