From fc4d290cb76192fd3847b8d9c003d2ed7167922b Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 3 Nov 2010 11:53:39 -0400 Subject: [PATCH] add support for NDLB-force-rport=safe param that does force-rport behavior only on endpoints we know are safe to do so on. This is a dirty hack to try to work with certain endpoints behind sonicwall which does not use the same port when it does nat, when the devices do not support rport, while not breaking devices that acutally use different ports that force-rport will break --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 6 ++++-- src/mod/endpoints/mod_sofia/sofia.c | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 8a93851773..5e1bb2ba7b 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Nov 2 17:57:25 CDT 2010 +Wed Nov 3 11:46:27 EDT 2010 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index abe7e68c44..7d3280fef6 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -1674,7 +1674,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags) progress = 60 * 1000; agent->sa_progress = progress; - if (server_rport > 2) + if (server_rport > 3) server_rport = 1; else if (server_rport < 0) server_rport = 1; @@ -3084,7 +3084,9 @@ int agent_check_request_via(nta_agent_t *agent, rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port)); msg_header_replace_param(msg_home(msg), v->v_common, rport); } - else if (agent->sa_server_rport == 2) { + else if (agent->sa_server_rport == 2 || + (agent->sa_server_rport == 3 && sip && sip->sip_user_agent && + sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7))) { rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port)); msg_header_replace_param(msg_home(msg), v->v_common, rport); } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0f9e265c4d..ac1251daa9 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2414,7 +2414,9 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) profile->dtmf_type = DTMF_NONE; } } else if (!strcasecmp(var, "NDLB-force-rport")) { - if (switch_true(val)) { + if (val && !strcasecmp(val, "safe")) { + profile->rport_level = 3; + } else if (switch_true(val)) { profile->rport_level = 2; } } else if (!strcasecmp(var, "caller-id-type")) { @@ -3083,7 +3085,9 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->dtmf_type = DTMF_NONE; } } else if (!strcasecmp(var, "NDLB-force-rport")) { - if (switch_true(val)) { + if (val && !strcasecmp(val, "safe")) { + profile->rport_level = 3; + } else if (switch_true(val)) { profile->rport_level = 2; } } else if (!strcasecmp(var, "auto-rtp-bugs")) {