The new parameter PHONENUMBER_TO_TG defines the comma-separated assignment of incoming SIP connections to a respective talkgroup. The format is 'PHONENUMBER_TO_TG=Sipnumber1:TG#1,Sipnumber2:TG#2,...'. Look into man page for further information.

This commit is contained in:
Adi Bier / DL1HRC 2022-06-03 09:46:37 +02:00
parent 05cdba7a96
commit ec5cf3342a
4 changed files with 51 additions and 1 deletions

View File

@ -870,6 +870,16 @@ a compressor with a very steep compression ratio like 10:1. The limiter is
used to help keeping down the audio level from Sip network for overmodulating
stations. Try values from -6 to -12 if the incoming Sip audio is to high. Set
to 0 to deactivate it.
.TP
.B PHONENUMBER_TO_TG
Comma-separated list of assignments of phonenumber(full||substring):Talkgroup.
When a phone call is received, the call is assigned to the defined TG according
to the recognized number. This can be used to prevent the transfer of an SIP
call to a network or to carry out a country-specific assignment. The number
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
.
.SS QSO Recorder Section
.

View File

@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <AsyncAudioCompressor.h>
#include <AsyncAudioAmp.h>
#include <AsyncAudioFilter.h>
#include <common.h>
/****************************************************************************
@ -88,7 +89,7 @@ using namespace pj;
*
****************************************************************************/
#define DEFAULT_SIPLIMITER_THRESH -1.0
#define PJSIP_VERSION "30052022"
#define PJSIP_VERSION "03062022"
/****************************************************************************
@ -532,6 +533,30 @@ bool SipLogic::initialize(void)
return false;
}
// set Tg's depending on the incoming sip phone number
std::string phonenumbers_to_tg;
if (cfg().getValue(name(), "PHONENUMBERS_TO_TG", phonenumbers_to_tg))
{
vector<string> nrlist;
SvxLink::splitStr(nrlist, phonenumbers_to_tg, ",");
for (vector<string>::const_iterator nr_it = nrlist.begin();
nr_it != nrlist.end(); nr_it++)
{
size_t pos;
if ((pos = (*nr_it).find(':')) != string::npos)
{
std::string r = (*nr_it).substr(0, pos);
uint32_t t = atoi((*nr_it).substr(pos+1, (*nr_it).length()-pos).c_str());
phoneNrTgVec[r] = t;
}
else
{
cout << "+++ WARNING: Wrong format in param " << name()
<< "/PHONENUMBERS_TO_TG, ignoring." << endl;
}
}
}
// create SipEndpoint - init library
try {
pj::EpConfig ep_cfg;
@ -886,6 +911,17 @@ void SipLogic::onIncomingCall(sip::_Account *acc, pj::OnIncomingCallParam &iprm)
std::string caller = getCallerNumber(ci.remoteUri);
for (std::map<std::string, uint32_t>::const_iterator it = phoneNrTgVec.begin();
it != phoneNrTgVec.end(); it++)
{
size_t pos;
if ((pos = caller.find(it->first)) == 0)
{
uint32_t tg = it->second;
setReceivedTg(tg);
}
}
stringstream ss;
ss << "ringing \"" << caller << "\"";
processLogicEvent(ss.str());
@ -1086,6 +1122,8 @@ void SipLogic::onCallState(sip::_Call *call, pj::OnCallStateParam &prm)
<< ci.totalDuration.sec << "."
<< ci.totalDuration.msec;
setReceivedTg(0);
// if no one is connected anymore, call out to autoconnect party
if (calls.empty() && m_autoconnect.length() > 0)
{

View File

@ -203,6 +203,7 @@ class SipLogic : public LogicBase
EventHandler *sip_event_handler;
MsgHandler *sip_msg_handler;
Async::AudioSelector *sipselector;
std::map<std::string, uint32_t> phoneNrTgVec;
SipLogic(const SipLogic&);
SipLogic& operator=(const SipLogic&);

View File

@ -135,6 +135,7 @@ SIP_CTRL_PTY=/tmp/sip_pty
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
[LinkToR4]
CONNECT_LOGICS=RepeaterLogic:94:SK3AB,SimplexLogic:92:SK3CD