diff --git a/libs/ysig/isup.cpp b/libs/ysig/isup.cpp index 02c38643..7ef5d9b7 100644 --- a/libs/ysig/isup.cpp +++ b/libs/ysig/isup.cpp @@ -23,7 +23,8 @@ */ #include "yatesig.h" -#include "string.h" +#include +#include using namespace TelEngine; @@ -133,6 +134,12 @@ static const SignallingFlags s_flags_paramcompat[] = { // Backward call indicators to be copied static const String s_copyBkInd("BackwardCallIndicators,OptionalBackwardCallIndicators"); +// Control operations +static const TokenDict s_dict_control[] = { + { "validate", SS7MsgISUP::CVT }, + { 0, 0 } +}; + // Default decoder, dumps raw octets static bool decodeRaw(const SS7ISUP* isup, NamedList& list, const IsupParam* param, const unsigned char* buf, unsigned int len, const String& prefix) @@ -2562,6 +2569,49 @@ void SS7ISUP::timerTick(const Time& when) } } +// Process a component control request +bool SS7ISUP::control(NamedList& params) +{ + String* ret = params.getParam("completion"); + const String* oper = params.getParam("operation"); + const char* cmp = params.getValue("component"); + int cmd = oper ? oper->toInteger(s_dict_control,-1) : -1; + + if (ret) { + if (oper && (cmd < 0)) + return false; + String part = params.getValue("partword"); + if (cmp) { + if (toString() != cmp) + return false; + for (const TokenDict* d = s_dict_control; d->token; d++) + Module::itemComplete(*ret,d->token,part); + return true; + } + return Module::itemComplete(*ret,toString(),part); + } + + if (!(cmp && toString() == cmp)) + return false; + Lock mylock(this); + ObjList* o = circuits()->circuits().skipNull(); + SignallingCircuit* cic = o ? static_cast(o->get()) : 0; + unsigned int code1 = cic ? cic->code() : 1; + switch (cmd) { + case SS7MsgISUP::CVT: + { + unsigned int code = params.getIntValue("circuit",code1); + SS7MsgISUP* msg = new SS7MsgISUP(SS7MsgISUP::CVT,code); + SS7Label label(m_type,*m_remotePoint,*m_defPoint,m_sls); + mylock.drop(); + transmitMessage(msg,label,false); + } + return true; + } + mylock.drop(); + return SignallingComponent::control(params); +} + // Process a notification generated by the attached network layer void SS7ISUP::notify(SS7Layer3* link, int sls) { @@ -3142,7 +3192,8 @@ void SS7ISUP::processControllerMsg(SS7MsgISUP* msg, const SS7Label& label, int s switch (msg->type()) { case SS7MsgISUP::CNF: // Confusion // TODO: check if this message was received in response to RSC, UBL, UBK, CGB, CGU - Debug(this,DebugNote,"%s with cause='%s' diagnostic='%s'",msg->name(), + Debug(this,DebugNote,"%s with cic=%u cause='%s' diagnostic='%s'", + msg->name(),msg->cic(), msg->params().getValue("CauseIndicators"), msg->params().getValue("CauseIndicators.diagnostic")); stopSGM = true; diff --git a/libs/ysig/yatesig.h b/libs/ysig/yatesig.h index cf3a2d75..dda88a9a 100644 --- a/libs/ysig/yatesig.h +++ b/libs/ysig/yatesig.h @@ -6059,6 +6059,13 @@ public: */ virtual void cleanup(const char* reason = "offline"); + /** + * Query or modify ISUP's settings or operational parameters + * @param params The list of parameters to query or change + * @return True if the control operation was executed + */ + virtual bool control(NamedList& params); + /** * Decode an ISUP message buffer to a list of parameters * @param msg Destination list of parameters