Doc added, changes/bugfix in call unregister. Two tcl functions added for session call handling, not for use at the moment.

This commit is contained in:
Adi Bier/DL1HRC 2022-03-14 20:57:00 +01:00
parent 321a514c8a
commit fd006f93e3
5 changed files with 110 additions and 7 deletions

20
README-Tetra-Sip Normal file
View File

@ -0,0 +1,20 @@
Steps to enable Sip dial-out by sending a Tetra state-SDS:
Look for "SipDialOfromTetra.tcl", configure it to your needs and store it under
/usr/share/svxlink/ebents.d/local
Be sure that you have the valid sipctrl path configured, it must fit to the param
SIP_CTRL_PTY parameter in your svxlink.conf (section [SipLogic]], e.g.
[SipLogic]
SIP_CTRL_PTY=/tmp/sipctrl
In the file "SipDialOfromTetra.tcl" configure the line:
set port [open "/tmp/sipctrl" w+];
With the next updates the configuration will be much easier, I promise ;)
Send questions to dl1hrc {at} . de
mni 73s de Adi / DL1HRC + DN6THW

View File

@ -0,0 +1,45 @@
###############################################################################
#
# TetraLogic event handlers
#
###############################################################################
#
# This is the namespace in which all functions below will exist. The name
# must match the corresponding section "[TetraLogic]" in the configuration
# file. The name may be changed but it must be changed in both places.
#
namespace eval TetraLogic {
#
# Executed when a DTMF command has been received
# cmd - The command
#
# Return 1 to hide the command from further processing is SvxLink or
# return 0 to make SvxLink continue processing as normal.
# ---> must return 0!
# adapt the port according to your needs
#
proc dtmf_cmd_received {cmd} {
variable port;
variable number;
if {[string length $cmd] > 5} {
puts "### dialing number $cmd via sip pty";
# adapt the port according to your needs:
# "/tmp/ctrl" must be equal to SIP_CTRL_PTY in [SipLogic]-section
set port [open "/tmp/sipctrl" w+];
set number "C$cmd";
puts $port $number;
close $port;
}
return 0;
}
# end of namespace
}
#
# This file has not been truncated
#

View File

@ -88,7 +88,7 @@ using namespace pj;
*
****************************************************************************/
#define DEFAULT_SIPLIMITER_THRESH -1.0
#define PJSIP_VERSION "30012022"
#define PJSIP_VERSION "14032022"
/****************************************************************************
@ -1001,16 +1001,19 @@ void SipLogic::onCallState(sip::_Call *call, pj::OnCallStateParam &prm)
<< ci.totalDuration.msec << " secs" << endl;
m_out_src->allSamplesFlushed();
if (calls.empty())
{
m_outto_sip->setOpen(false);
m_infrom_sip->setOpen(false);
//onSquelchOpen(false);
}
unregisterCall(call);
ss << "hangup_call " << caller << " "
<< ci.totalDuration.sec << "."
<< ci.totalDuration.msec;
}
else if (ci.state == PJSIP_INV_STATE_EARLY)
{
ss << "pjsip_state_early " << caller;
}
else if (ci.state == PJSIP_INV_STATE_NULL)
{
ss << "pjsip_state_null " << caller;
}
else
{
cout << "unknown_callstate " << ci.state;
@ -1235,6 +1238,26 @@ void SipLogic::initCall(const string& remote)
} /* SipLogic::initCall */
void SipLogic::unregisterCall(sip::_Call *call)
{
for (std::vector<sip::_Call *>::iterator it=calls.begin();
it != calls.end(); it++)
{
if (*it == call)
{
calls.erase(it);
break;
}
}
if (calls.empty())
{
m_outto_sip->setOpen(false);
m_infrom_sip->setOpen(false);
squelch_det->reset();
}
} /* SipLogic::unregisterCall */
/*
* This file has not been truncated
*/

View File

@ -223,6 +223,7 @@ class SipLogic : public LogicBase
void callTimeout(Async::Timer *t=0);
void flushTimeout(Async::Timer *t=0);
void onSquelchOpen(bool is_open);
void unregisterCall(sip::_Call *call);
}; /* class SipLogic */

View File

@ -309,6 +309,20 @@ proc call_state_confirmed {caller} {
proc unknown_callstate {caller} {
}
#
# do not use!
#
proc pjsip_state_early {caller} {
}
#
# do not use!
#
proc pjsip_state_null {caller} {
}
# end of namespace
}