mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
Convert some behaviors to optional.
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.
This commit is contained in:
parent
0fa6cc6f01
commit
5c8a3b12fd
@ -270,6 +270,9 @@ typedef enum {
|
||||
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;
|
||||
|
@ -4103,6 +4103,24 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
} 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);
|
||||
|
@ -2180,8 +2180,8 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -1187,10 +1187,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
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') {
|
||||
@ -1269,24 +1269,29 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
|
||||
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;
|
||||
@ -1737,9 +1742,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user