Added capability to intercept more messages in isupmangler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@3652 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
f909830717
commit
286f59e19c
|
@ -27,4 +27,11 @@
|
||||||
;remotepointcode=
|
;remotepointcode=
|
||||||
|
|
||||||
; symmetric: boolean: Intercept and mangle messages in the opposite direction too
|
; symmetric: boolean: Intercept and mangle messages in the opposite direction too
|
||||||
|
; Symmetric should be enabled if intercepting more than just IAM
|
||||||
;symmetric=no
|
;symmetric=no
|
||||||
|
|
||||||
|
; intercept: keyword: What class of messages to intercept
|
||||||
|
; iam: Only intercept IAM
|
||||||
|
; cdr: Intercept most CDR related messages: IAM,SAM,ACM,CPG,ANM,CON,SUS,RES,REL,RLC
|
||||||
|
; all: Intercept almost all messages, except UPT,UPA,NRM,PAM,CNF,USR
|
||||||
|
;intercept=iam
|
||||||
|
|
|
@ -33,10 +33,15 @@ class IsupIntercept : public SS7ISUP
|
||||||
friend class IsupMangler;
|
friend class IsupMangler;
|
||||||
YCLASS(IsupIntercept,SS7ISUP)
|
YCLASS(IsupIntercept,SS7ISUP)
|
||||||
public:
|
public:
|
||||||
|
enum What {
|
||||||
|
Iam, // IAM only
|
||||||
|
Cdr, // IAM,SAM,ACM,CPG,ANM,CON,SUS,RES,REL,RLC
|
||||||
|
All
|
||||||
|
};
|
||||||
inline IsupIntercept(const NamedList& params)
|
inline IsupIntercept(const NamedList& params)
|
||||||
: SignallingComponent(params,¶ms), SS7ISUP(params),
|
: SignallingComponent(params,¶ms), SS7ISUP(params),
|
||||||
m_used(true), m_symmetric(false)
|
m_used(true), m_symmetric(false), m_what(Iam)
|
||||||
{ m_symmetric = params.getBoolValue("symmetric",m_symmetric); }
|
{ }
|
||||||
virtual bool initialize(const NamedList* config);
|
virtual bool initialize(const NamedList* config);
|
||||||
void dispatched(SS7MsgISUP& isup, const Message& msg, const SS7Label& label, int sls, bool accepted);
|
void dispatched(SS7MsgISUP& isup, const Message& msg, const SS7Label& label, int sls, bool accepted);
|
||||||
protected:
|
protected:
|
||||||
|
@ -48,6 +53,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
bool m_used;
|
bool m_used;
|
||||||
bool m_symmetric;
|
bool m_symmetric;
|
||||||
|
What m_what;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IsupMessage : public Message
|
class IsupMessage : public Message
|
||||||
|
@ -82,6 +88,16 @@ public:
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const TokenDict s_dict_what[] = {
|
||||||
|
{ "IAM", IsupIntercept::Iam },
|
||||||
|
{ "iam", IsupIntercept::Iam },
|
||||||
|
{ "CDR", IsupIntercept::Cdr },
|
||||||
|
{ "cdr", IsupIntercept::Cdr },
|
||||||
|
{ "All", IsupIntercept::All },
|
||||||
|
{ "all", IsupIntercept::All },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static ObjList s_manglers;
|
static ObjList s_manglers;
|
||||||
|
|
||||||
INIT_PLUGIN(IsupMangler);
|
INIT_PLUGIN(IsupMangler);
|
||||||
|
@ -93,7 +109,10 @@ bool IsupIntercept::initialize(const NamedList* config)
|
||||||
return false;
|
return false;
|
||||||
SS7ISUP::initialize(config);
|
SS7ISUP::initialize(config);
|
||||||
m_symmetric = config->getBoolValue("symmetric",m_symmetric);
|
m_symmetric = config->getBoolValue("symmetric",m_symmetric);
|
||||||
Debug(this,DebugAll,"Added %u Point Codes",setPointCode(*config));
|
m_what = (What)config->getIntValue("intercept",s_dict_what,m_what);
|
||||||
|
Debug(this,DebugAll,"Added %u Point Codes, intercepts %s %s",
|
||||||
|
setPointCode(*config),lookup(m_what,s_dict_what,"???"),
|
||||||
|
(m_symmetric) ? "both ways" : "one way");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,13 +142,39 @@ HandledMSU IsupIntercept::receivedMSU(const SS7MSU& msu, const SS7Label& label,
|
||||||
name = (int)type;
|
name = (int)type;
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
// always intercept IAM
|
||||||
case SS7MsgISUP::IAM:
|
case SS7MsgISUP::IAM:
|
||||||
return processMSU(type,cic,s+3,len-3,label,network,sls) ?
|
break;
|
||||||
HandledMSU::Accepted : HandledMSU::Rejected;
|
// other CDR relevant messages
|
||||||
|
case SS7MsgISUP::SAM:
|
||||||
|
case SS7MsgISUP::ACM:
|
||||||
|
case SS7MsgISUP::CPG:
|
||||||
|
case SS7MsgISUP::ANM:
|
||||||
|
case SS7MsgISUP::CON:
|
||||||
|
case SS7MsgISUP::SUS:
|
||||||
|
case SS7MsgISUP::RES:
|
||||||
|
case SS7MsgISUP::REL:
|
||||||
|
case SS7MsgISUP::RLC:
|
||||||
|
if (m_what >= Cdr)
|
||||||
|
break;
|
||||||
|
return HandledMSU::Rejected;
|
||||||
|
// we shouldn't mess with these messages
|
||||||
|
case SS7MsgISUP::UPT:
|
||||||
|
case SS7MsgISUP::UPA:
|
||||||
|
case SS7MsgISUP::NRM:
|
||||||
|
case SS7MsgISUP::PAM:
|
||||||
|
case SS7MsgISUP::CNF:
|
||||||
|
case SS7MsgISUP::USR:
|
||||||
|
return HandledMSU::Rejected;
|
||||||
|
// intercepting all messages is risky
|
||||||
default:
|
default:
|
||||||
|
if (m_what >= All)
|
||||||
|
break;
|
||||||
// let the message pass through
|
// let the message pass through
|
||||||
return HandledMSU::Rejected;
|
return HandledMSU::Rejected;
|
||||||
}
|
}
|
||||||
|
return processMSU(type,cic,s+3,len-3,label,network,sls) ?
|
||||||
|
HandledMSU::Accepted : HandledMSU::Rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsupIntercept::processMSU(SS7MsgISUP::Type type, unsigned int cic,
|
bool IsupIntercept::processMSU(SS7MsgISUP::Type type, unsigned int cic,
|
||||||
|
@ -160,7 +205,11 @@ bool IsupIntercept::processMSU(SS7MsgISUP::Type type, unsigned int cic,
|
||||||
String addr;
|
String addr;
|
||||||
addr << toString() << "/" << cic;
|
addr << toString() << "/" << cic;
|
||||||
m->addParam("address",addr);
|
m->addParam("address",addr);
|
||||||
m->addParam("sls",String(sls));
|
m->addParam("dpc",String(label.dpc().pack(label.type())));
|
||||||
|
m->addParam("opc",String(label.opc().pack(label.type())));
|
||||||
|
m->addParam("sls",String(label.sls()));
|
||||||
|
m->addParam("slc",String(sls));
|
||||||
|
m->addParam("cic",String(cic));
|
||||||
m->copyParams(msg->params());
|
m->copyParams(msg->params());
|
||||||
TelEngine::destruct(msg);
|
TelEngine::destruct(msg);
|
||||||
return Engine::enqueue(m);
|
return Engine::enqueue(m);
|
||||||
|
|
Loading…
Reference in New Issue