These all were set before but now are disabled by default because they are not proper to have enabled without a good reason.
tcp-unreg-on-socket-close
If registration is TCP or TLS and socket connection is interrupted, unregister the client.
tcp-always-nat
Treat all TCP connections as NATTED, this causes all traffic back to the phone to reuse the existing TCP socket but may
cause problems when not used with TCP keepalive.
tls-always-nat
Same as tcp-always-nat but only for TLS connections.
PFLAG_MESSAGES_RESPOND_200_OK,
PFLAG_SUBSCRIBE_RESPOND_200_OK,
PFLAG_PARSE_ALL_INVITE_HEADERS,
+ PFLAG_TCP_UNREG_ON_SOCKET_CLOSE,
+ PFLAG_TLS_ALWAYS_NAT,
+ PFLAG_TCP_ALWAYS_NAT,
/* No new flags below this line */
PFLAG_MAX
} PFLAGS;
} else {
sofia_clear_pflag(profile, PFLAG_MWI_USE_REG_CALLID);
}
+ } else if (!strcasecmp(var, "tcp-unreg-on-socket-close")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE);
+ }
+ } else if (!strcasecmp(var, "tcp-always-nat")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
+ }
+ } else if (!strcasecmp(var, "tls-always-nat")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
+ }
} else if (!strcasecmp(var, "presence-proto-lookup")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
}
- test_sql = switch_mprintf("delete from sip_registrations where (sub_host is null or contact like '%%TCP%%' "
- "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
+ test_sql = switch_mprintf("delete from sip_registrations where sub_host is null "
+ "and hostname='%q' "
"and network_ip like '%%' and network_port like '%%' and sip_username "
"like '%%' and mwi_user like '%%' and mwi_host like '%%' "
"and orig_server_host like '%%' and orig_hostname like '%%'", mod_sofia_globals.hostname);
if (sip && sip->sip_via && (vproto = sip->sip_via->v_protocol)) {
if (!strcasecmp(vproto, "sip/2.0/ws")) {
is_ws = 1;
- is_nat++;
+ is_nat = "ws";
} else if (!strcasecmp(vproto, "sip/2.0/wss")) {
is_wss = 1;
- is_nat++;
+ is_nat = "wss";
if (uparams && (p = switch_stristr("transport=ws", uparams))) {
if (p[12] != 's') {
if (uparams && switch_stristr("transport=tls", uparams)) {
is_tls += 1;
- is_nat++;
+ if (sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT)) {
+ is_nat = "tls";
+ }
}
if (!is_wss && !is_ws && uparams && switch_stristr("transport=ws", uparams)) {
- is_nat++;
+ is_nat = "ws";
is_ws += 1;
}
if (sip->sip_contact->m_url->url_type == url_sips) {
proto = "sips";
is_tls += 2;
- is_nat++;
+ if (sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT)) {
+ is_nat = "tls";
+ }
}
-
if (uparams && switch_stristr("transport=tcp", uparams)) {
is_tcp = 1;
- is_nat++;
+ if (sofia_test_pflag(profile, PFLAG_TCP_ALWAYS_NAT)) {
+ is_nat = "tcp";
+ }
}
display = contact->m_display;
switch_safe_free(url);
switch_safe_free(contact);
-
-
- if ((is_wss || is_ws || is_tcp || is_tls) && !sofia_private && call_id) {
+ if ((is_wss || is_ws || (sofia_test_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE) && (is_tcp || is_tls))) && !sofia_private && call_id) {
char key[256] = "";
nua_handle_t *hnh;
switch_snprintf(key, sizeof(key), "%s%s%s", call_id, network_ip, network_port_c);