diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 29c5084c5d..ad0744348a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -987,7 +987,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags) void *smime = agent->sa_smime; uint32_t flags = agent->sa_flags; int rport = agent->sa_rport; - int server_rport = agent->sa_server_rport; + unsigned server_rport = agent->sa_server_rport; int tcp_rport = agent->sa_tcp_rport; unsigned preload = agent->sa_preload; unsigned threadpool = agent->sa_tport_threadpool; @@ -2579,7 +2579,7 @@ 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 { + else if (agent->sa_server_rport == 2) { 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/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h b/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h index dd83b8393f..ba3fc44044 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h @@ -226,7 +226,7 @@ struct nta_agent_s /** If true, use rport at client */ unsigned sa_rport:1; /** If true, use rport at server */ - unsigned sa_server_rport:1; + unsigned sa_server_rport:2; /** If true, use rport with tcp, too */ unsigned sa_tcp_rport:1; diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c index 530f91b84c..9e01584995 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c @@ -1334,7 +1334,7 @@ tag_typedef_t ntatag_client_rport = BOOLTAG_TYPEDEF(client_rport); * * @sa @RFC3581, NTATAG_CLIENT_RPORT(), NTATAG_TCP_RPORT(), @Via */ -tag_typedef_t ntatag_server_rport = BOOLTAG_TYPEDEF(server_rport); +tag_typedef_t ntatag_server_rport = UINTTAG_TYPEDEF(server_rport); /**@def NTATAG_TCP_RPORT(x) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0fc7ea1be5..fb7d7f7fd8 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -544,6 +544,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), NTATAG_UDP_MTU(65536), + NTATAG_SERVER_RPORT(2), TAG_IF(tportlog, TPTAG_LOG(1)), TAG_END()); /* Last tag should always finish the sequence */ @@ -586,6 +587,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void node->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ + NTATAG_SERVER_RPORT(2), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */ nua_set_params(node->nua,