diff --git a/README-Tetra-Sip b/README-Tetra-Sip new file mode 100644 index 00000000..82f588e9 --- /dev/null +++ b/README-Tetra-Sip @@ -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 \ No newline at end of file diff --git a/src/svxlink/svxlink/SipDialOutfromTetra.tcl b/src/svxlink/svxlink/SipDialOutfromTetra.tcl new file mode 100644 index 00000000..081547fa --- /dev/null +++ b/src/svxlink/svxlink/SipDialOutfromTetra.tcl @@ -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 +# diff --git a/src/svxlink/svxlink/SipLogic.cpp b/src/svxlink/svxlink/SipLogic.cpp index 64b72d9a..b8cf5f93 100644 --- a/src/svxlink/svxlink/SipLogic.cpp +++ b/src/svxlink/svxlink/SipLogic.cpp @@ -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::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 */ diff --git a/src/svxlink/svxlink/SipLogic.h b/src/svxlink/svxlink/SipLogic.h index 6a8dc2b8..77a974fb 100644 --- a/src/svxlink/svxlink/SipLogic.h +++ b/src/svxlink/svxlink/SipLogic.h @@ -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 */ diff --git a/src/svxlink/svxlink/SipLogic.tcl b/src/svxlink/svxlink/SipLogic.tcl index e047bda7..cbbe98e7 100644 --- a/src/svxlink/svxlink/SipLogic.tcl +++ b/src/svxlink/svxlink/SipLogic.tcl @@ -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 }