Merge remote-tracking branch 'origin/pjSipLogic' into tetra-sip-usrp

This commit is contained in:
Adi Bier / DL1HRC 2022-11-15 11:39:07 +01:00
commit 175277fa73
4 changed files with 22 additions and 4 deletions

View File

@ -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

View File

@ -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
.

View File

@ -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=1
# ToDo, section still not active
[Phonenumber_to_Tg]

View File

@ -89,7 +89,7 @@ using namespace pj;
*
****************************************************************************/
#define DEFAULT_SIPLIMITER_THRESH -1.0
#define PJSIP_VERSION "06112022"
#define PJSIP_VERSION "15112022"
/****************************************************************************
@ -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;