From 724fb08068e1c3bf740d7718e4fb84946383b5f7 Mon Sep 17 00:00:00 2001 From: Adi Bier / DL1HRC Date: Tue, 15 Nov 2022 11:27:41 +0100 Subject: [PATCH 1/3] Parameter USE_TCP added to enable TCP as transport layer. --- .../svxlink/contrib/SipLogic/SipLogic.conf.5 | 3 +++ .../svxlink/contrib/SipLogic/SipLogic.conf.in | 1 + .../svxlink/contrib/SipLogic/SipLogic.cpp | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.5 b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.5 index d944843f..59a5cff7 100644 --- a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.5 +++ b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.5 @@ -152,6 +152,9 @@ format transmitted must match the configuration (+49 != 0049). Whole SIP numbers as well as parts of phone numbers can be configured, with the evaluation taking place on the left-hand side. Example: PHONENUMBER_TO_TG=0049:262,0034:214,0043:232,0049123454543:991 +.TP +.B USE_TCP +If set, TCP is used as transport layer instead of UDP (default). . .SH FILES . diff --git a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in index 57921565..0579f95c 100644 --- a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in +++ b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in @@ -27,6 +27,7 @@ EVENT_HANDLER=@SVX_SHARE_INSTALL_DIR@/events.tcl SIP_PREAMP=3 SIP_LIMITER_THRESH=-1.0 PHONENUMBER_TO_TG=0049:262,0034:232,0041:222,017612345678:9999 +#USE_TCP # ToDo, section still not active [Phonenumber_to_Tg] diff --git a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp index 761f6aa9..61499211 100644 --- a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp +++ b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp @@ -552,11 +552,22 @@ bool SipLogic::initialize(Async::Config& cfgobj, const std::string& logic_name) return false; } + // use UDP or TCP? + bool use_tcp = false; + cfg().getValue(name(), "USE_TCP", use_tcp); + // Sip transport layer creation try { TransportConfig tcfg; tcfg.port = m_sip_port; - ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg); + if (use_tcp) + { + ep.transportCreate(PJSIP_TRANSPORT_TCP, tcfg); + } + else + { + ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg); + } ep.libStart(); } catch (Error& err) { cout << "*** ERROR creating transport layer in " @@ -572,6 +583,10 @@ bool SipLogic::initialize(Async::Config& cfgobj, const std::string& logic_name) acc_cfg.idUri += m_username; acc_cfg.idUri += "@"; acc_cfg.idUri += m_sipserver; + if (use_tcp) + { + acc_cfg.idUri += ";transport=tcp"; + } acc_cfg.idUri += ">"; acc_cfg.regConfig.registrarUri = "sip:"; acc_cfg.regConfig.registrarUri += m_sipregistrar; From e898429240317eb3c9fe9f1cb037b140fb14f40c Mon Sep 17 00:00:00 2001 From: Adi Bier / DL1HRC Date: Tue, 15 Nov 2022 11:32:30 +0100 Subject: [PATCH 2/3] Version information updated --- src/svxlink/svxlink/contrib/SipLogic/README.adoc | 3 +-- src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/svxlink/svxlink/contrib/SipLogic/README.adoc b/src/svxlink/svxlink/contrib/SipLogic/README.adoc index 8d010910..aa903abf 100644 --- a/src/svxlink/svxlink/contrib/SipLogic/README.adoc +++ b/src/svxlink/svxlink/contrib/SipLogic/README.adoc @@ -5,8 +5,7 @@ Contrib: SipLogic # # SipLogic (beta) # Adi Bier / DL1HRC (dl1hrc [at] gmx.de) -# V0.2.0 - 15.03.2019 -# V0.2.1 - 05.09.2022 +# Version 15112022 # ---- SipLogic.conf is a sample configuration for a SipLogic connected to a Fritzbox diff --git a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp index 61499211..3d55931e 100644 --- a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp +++ b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.cpp @@ -89,7 +89,7 @@ using namespace pj; * ****************************************************************************/ #define DEFAULT_SIPLIMITER_THRESH -1.0 -#define PJSIP_VERSION "06112022" +#define PJSIP_VERSION "15112022" /**************************************************************************** From ee24d2f250f35f93b4c5c9186668ff89ffdf6b43 Mon Sep 17 00:00:00 2001 From: Adi Bier / DL1HRC Date: Tue, 15 Nov 2022 11:37:47 +0100 Subject: [PATCH 3/3] Parameter in example SipLogic.conf.in corrected to USE_TCP=1 --- src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in index 0579f95c..07387cfe 100644 --- a/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in +++ b/src/svxlink/svxlink/contrib/SipLogic/SipLogic.conf.in @@ -27,7 +27,7 @@ EVENT_HANDLER=@SVX_SHARE_INSTALL_DIR@/events.tcl SIP_PREAMP=3 SIP_LIMITER_THRESH=-1.0 PHONENUMBER_TO_TG=0049:262,0034:232,0041:222,017612345678:9999 -#USE_TCP +#USE_TCP=1 # ToDo, section still not active [Phonenumber_to_Tg]