Added support for controlling ISUP, implemented sending CVT on demand.

git-svn-id: http://voip.null.ro/svn/yate@3187 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-04-12 22:02:27 +00:00
parent 2753c9faee
commit e1f182fee3
2 changed files with 60 additions and 2 deletions

View File

@ -23,7 +23,8 @@
*/
#include "yatesig.h"
#include "string.h"
#include <yatephone.h>
#include <string.h>
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<SignallingCircuit*>(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;

View File

@ -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