Added ability to match NTFY by endpoint, use it as default for FXO/FXS.
Report base endpoint of each span in status. git-svn-id: http://voip.null.ro/svn/yate@4565 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
43a1b64125
commit
3690dfe215
|
@ -204,6 +204,10 @@
|
|||
; Normally the default bearer is not set so a B: line is added when needed
|
||||
;bearer=
|
||||
|
||||
; match_ntfy: bool: Strict match the X: id in NTFY against the local value
|
||||
; This can cause trouble with FXS/FXO persistent notifications
|
||||
;match_ntfy=yes for digital gateways, no for analogic
|
||||
|
||||
; req_fax: bool: Request Fax Tone detection from gateway
|
||||
; This requests notification for G/ft (Generic package, Fax Tone)
|
||||
;req_fax=yes
|
||||
|
|
|
@ -144,9 +144,9 @@ public:
|
|||
{ return m_rqntType; }
|
||||
inline const char* rqntStr() const
|
||||
{ return m_rqntStr; }
|
||||
bool ownsId(const String& rqId) const;
|
||||
bool ownsId(const String& rqId, const String& epId) const;
|
||||
static SignallingComponent* create(const String& type, const NamedList& name);
|
||||
static MGCPSpan* findNotify(const String& id);
|
||||
static MGCPSpan* findNotify(const String& id, const String& epId);
|
||||
bool getBoolParam(const String& param, bool defValue) const;
|
||||
bool matchEndpoint(const MGCPEndpointId& ep);
|
||||
bool processEvent(MGCPTransaction* tr, MGCPMessage* mm);
|
||||
|
@ -167,6 +167,7 @@ private:
|
|||
bool m_sdpForward;
|
||||
bool m_fxo;
|
||||
bool m_fxs;
|
||||
bool m_ntfyMatch;
|
||||
bool m_rqntEmbed;
|
||||
RqntType m_rqntType;
|
||||
String m_rqntStr;
|
||||
|
@ -456,7 +457,7 @@ bool YMGCPEngine::processEvent(MGCPTransaction* trans, MGCPMessage* msg)
|
|||
if (wrap)
|
||||
ok = wrap->processNotify(trans,msg,*event);
|
||||
else {
|
||||
span = MGCPSpan::findNotify(*rqId);
|
||||
span = MGCPSpan::findNotify(*rqId,msg->endpointId());
|
||||
if (span)
|
||||
ok = span->processNotify(trans,msg,*event,*rqId);
|
||||
else {
|
||||
|
@ -878,7 +879,7 @@ SignallingComponent* MGCPSpan::create(const String& type, const NamedList& name)
|
|||
}
|
||||
|
||||
// Find a span by its Notify-ID
|
||||
MGCPSpan* MGCPSpan::findNotify(const String& id)
|
||||
MGCPSpan* MGCPSpan::findNotify(const String& id, const String& epId)
|
||||
{
|
||||
if (id.null())
|
||||
return 0;
|
||||
|
@ -886,7 +887,7 @@ MGCPSpan* MGCPSpan::findNotify(const String& id)
|
|||
ObjList* l = &s_spans;
|
||||
for (; l; l=l->next()) {
|
||||
MGCPSpan* s = static_cast<MGCPSpan*>(l->get());
|
||||
if (s && s->ownsId(id))
|
||||
if (s && s->ownsId(id,epId))
|
||||
return s;
|
||||
}
|
||||
return 0;
|
||||
|
@ -897,7 +898,7 @@ MGCPSpan::MGCPSpan(const NamedList& params, const char* name, const MGCPEpInfo&
|
|||
static_cast<SignallingCircuitGroup*>(params.getObject("SignallingCircuitGroup"))),
|
||||
m_circuits(0), m_count(0), m_epId(ep), m_operational(false),
|
||||
m_rtpForward(false), m_sdpForward(false), m_fxo(false), m_fxs(false),
|
||||
m_rqntEmbed(true), m_rqntType(RqntOnce)
|
||||
m_ntfyMatch(true), m_rqntEmbed(true), m_rqntType(RqntOnce)
|
||||
{
|
||||
Debug(&splugin,DebugAll,"MGCPSpan::MGCPSpan(%p,'%s') [%p]",
|
||||
¶ms,name,this);
|
||||
|
@ -906,6 +907,7 @@ MGCPSpan::MGCPSpan(const NamedList& params, const char* name, const MGCPEpInfo&
|
|||
m_rqntStr = "D/[0-9#*](N)";
|
||||
const AnalogLineGroup* analog = YOBJECT(AnalogLineGroup,group());
|
||||
if (analog) {
|
||||
m_ntfyMatch = false;
|
||||
switch (analog->type()) {
|
||||
case AnalogLine::FXO:
|
||||
m_fxo = true;
|
||||
|
@ -999,6 +1001,7 @@ bool MGCPSpan::init(const NamedList& params)
|
|||
m_rtpForward = config->getBoolValue(YSTRING("forward_rtp"),!(m_fxo || m_fxs));
|
||||
m_sdpForward = config->getBoolValue(YSTRING("forward_sdp"),false);
|
||||
m_bearer = lookup(config->getIntValue(YSTRING("bearer"),s_dict_payloads,-1),s_dict_gwbearerinfo);
|
||||
m_ntfyMatch = config->getBoolValue(YSTRING("match_ntfy"),m_ntfyMatch);
|
||||
m_rqntEmbed = config->getBoolValue(YSTRING("req_embed"),true);
|
||||
m_rqntType = (RqntType)config->getIntValue(YSTRING("req_dtmf"),s_dict_rqnt,RqntOnce);
|
||||
bool fax = config->getBoolValue(YSTRING("req_fax"),true);
|
||||
|
@ -1174,14 +1177,22 @@ bool MGCPSpan::matchEndpoint(const MGCPEndpointId& ep)
|
|||
}
|
||||
|
||||
// Check if a request Id is for this span or one of its circuits
|
||||
bool MGCPSpan::ownsId(const String& rqId) const
|
||||
bool MGCPSpan::ownsId(const String& rqId, const String& epId) const
|
||||
{
|
||||
if (ntfyId() == rqId)
|
||||
return true;
|
||||
for (unsigned int i = 0; i < m_count; i++) {
|
||||
MGCPCircuit* circuit = m_circuits[i];
|
||||
if (circuit && (circuit->ntfyId() == rqId))
|
||||
return true;
|
||||
if (!circuit)
|
||||
continue;
|
||||
if (m_ntfyMatch) {
|
||||
if (circuit->ntfyId() == rqId)
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (circuit->epId() == epId)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1201,7 +1212,7 @@ MGCPCircuit* MGCPSpan::findCircuit(const String& epId, const String& rqId) const
|
|||
MGCPCircuit* circuit = m_circuits[i];
|
||||
if (!circuit)
|
||||
continue;
|
||||
if (localId) {
|
||||
if (localId && m_ntfyMatch) {
|
||||
if (circuit->ntfyId() != rqId)
|
||||
continue;
|
||||
}
|
||||
|
@ -2167,6 +2178,10 @@ void MGCPPlugin::statusDetail(String& str)
|
|||
MGCPWrapper* w = static_cast<MGCPWrapper*>(l->get());
|
||||
str.append(w->id(),",") << "=" << w->callId();
|
||||
}
|
||||
for (l = s_spans.skipNull(); l; l = l->skipNext()) {
|
||||
MGCPSpan* s = static_cast<MGCPSpan*>(l->get());
|
||||
str.append(s->id(),",") << "=" << s->epId().id();
|
||||
}
|
||||
s_mutex.unlock();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue