From 8ee58a48931c51d418768f61f2e53b0f567dc412 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 7 Oct 2026 14:29:52 +0200 Subject: [PATCH 1/2] pjsua: preserve ephemeral TLS and IPv6 ports --- pjsip-apps/src/pjsua/pjsua_app.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index fd60ebb765..15b226fc2f 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -2071,7 +2071,9 @@ static pj_status_t app_init(void) pjsua_acc_id aid; pjsip_transport_type_e type = PJSIP_TRANSPORT_TCP6; - tcp_cfg.port += 10; + if (tcp_cfg.port != 0) { + tcp_cfg.port += 10; + } status = pjsua_transport_create(type, &tcp_cfg, @@ -2113,11 +2115,15 @@ static pj_status_t app_init(void) sizeof(tcp_cfg.qos_params)); /* Set TLS port as TCP port+1 */ - tcp_cfg.port++; + if (tcp_cfg.port != 0) { + tcp_cfg.port++; + } status = pjsua_transport_create(PJSIP_TRANSPORT_TLS, &tcp_cfg, &transport_id); - tcp_cfg.port--; + if (tcp_cfg.port != 0) { + tcp_cfg.port--; + } if (status != PJ_SUCCESS) goto on_error; @@ -2145,7 +2151,9 @@ static pj_status_t app_init(void) pjsua_acc_id aid; pjsip_transport_type_e type = PJSIP_TRANSPORT_TLS6; - tcp_cfg.port += 10; + if (tcp_cfg.port != 0) { + tcp_cfg.port += 10; + } status = pjsua_transport_create(type, &tcp_cfg, From bf0352baa7bc6b819f6f286f2b464a83f286b94a Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Oct 2026 19:28:53 +0200 Subject: [PATCH 2/2] pjsua: keep UDP6 on an ephemeral port when --local-port=0 --- pjsip-apps/src/pjsua/pjsua_app.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 15b226fc2f..a953e6e9c2 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) + * Copyright (C) 2008-2026 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono * * This program is free software; you can redistribute it and/or modify @@ -1998,9 +1998,7 @@ static pj_status_t app_init(void) pjsua_transport_config udp_cfg; udp_cfg = app_config.udp_cfg; - if (udp_cfg.port == 0) - udp_cfg.port = 5060; - else + if (udp_cfg.port != 0) udp_cfg.port += 10; status = pjsua_transport_create(type, &udp_cfg,