Circuit (un)block command can now be used to change remote side of the circuit.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4630 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
f4ac6ab867
commit
0736acebc1
|
@ -5359,8 +5359,13 @@ bool SS7ISUP::handleCicBlockCommand(const NamedList& p, bool block)
|
|||
SS7MsgISUP::Type remove = SS7MsgISUP::Unknown;
|
||||
bool force = p.getBoolValue(YSTRING("force"));
|
||||
String* param = p.getParam(YSTRING("circuit"));
|
||||
bool remote = p.getBoolValue(YSTRING("remote"));
|
||||
Lock mylock(this);
|
||||
if (param) {
|
||||
if (remote) {
|
||||
unsigned int code = param->toInteger();
|
||||
return handleCicBlockRemoteCommand(p,&code,1,block);
|
||||
}
|
||||
SignallingCircuit* cic = circuits()->find(param->toInteger());
|
||||
msg = buildCicBlock(cic,block,force);
|
||||
if (!msg)
|
||||
|
@ -5369,7 +5374,7 @@ bool SS7ISUP::handleCicBlockCommand(const NamedList& p, bool block)
|
|||
remove = block ? SS7MsgISUP::UBL : SS7MsgISUP::BLK;
|
||||
}
|
||||
else {
|
||||
// NOTE: we assume the circuits belongs to the same span
|
||||
// NOTE: we assume the circuits belongs to the same span for local (un)block
|
||||
param = p.getParam(YSTRING("circuits"));
|
||||
if (TelEngine::null(param)) {
|
||||
Debug(this,DebugNote,"Circuit '%s' missing circuit(s)",
|
||||
|
@ -5380,15 +5385,29 @@ bool SS7ISUP::handleCicBlockCommand(const NamedList& p, bool block)
|
|||
unsigned int count = 0;
|
||||
unsigned int* cics = SignallingUtils::parseUIntArray(*param,1,0xffffffff,count,true);
|
||||
if (!cics) {
|
||||
SignallingCircuitRange* range = circuits()->findRange(*param);
|
||||
if (!(range && (count = range->count()))) {
|
||||
// Allow '*' (all circuits) for remote
|
||||
if (!(remote && *param == YSTRING("*"))) {
|
||||
SignallingCircuitRange* range = circuits()->findRange(*param);
|
||||
if (range)
|
||||
cics = range->copyRange(count);
|
||||
}
|
||||
else {
|
||||
String tmp;
|
||||
circuits()->getCicList(tmp);
|
||||
SignallingCircuitRange* range = new SignallingCircuitRange(tmp);
|
||||
cics = range->copyRange(count);
|
||||
TelEngine::destruct(range);
|
||||
}
|
||||
if (!cics) {
|
||||
Debug(this,DebugNote,"Circuit group '%s': invalid circuits=%s",
|
||||
p.getValue(YSTRING("operation")),param->c_str());
|
||||
return false;
|
||||
}
|
||||
cics = new unsigned int[count];
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
cics[i] = (*range)[i];
|
||||
}
|
||||
if (remote) {
|
||||
bool ok = handleCicBlockRemoteCommand(p,cics,count,block);
|
||||
delete[] cics;
|
||||
return ok;
|
||||
}
|
||||
if (count > 32) {
|
||||
Debug(this,DebugNote,"Circuit group '%s': too many circuits %u (max=32)",
|
||||
|
@ -5486,6 +5505,33 @@ bool SS7ISUP::handleCicBlockCommand(const NamedList& p, bool block)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Handle remote circuit(s) (un)block command
|
||||
bool SS7ISUP::handleCicBlockRemoteCommand(const NamedList& p, unsigned int* cics,
|
||||
unsigned int count, bool block)
|
||||
{
|
||||
if (!(cics && count))
|
||||
return false;
|
||||
bool hwFail = p.getBoolValue(YSTRING("hwfail"));
|
||||
if (debugAt(DebugNote)) {
|
||||
String s;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
s.append(String(cics[i]),",");
|
||||
Debug(this,DebugNote,"Circuit remote '%s' command: hwfail=%s circuits=%s [%p]",
|
||||
p.getValue(YSTRING("operation")),String::boolText(hwFail),s.c_str(),this);
|
||||
}
|
||||
bool found = false;
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
if (blockCircuit(cics[i],block,true,hwFail,true,true))
|
||||
found = true;
|
||||
else
|
||||
Debug(this,DebugNote,"Circuit remote '%s' command: cic %u not found [%p]",
|
||||
p.getValue(YSTRING("operation")),cics[i],this);
|
||||
}
|
||||
if (found)
|
||||
m_verifyEvent = true;
|
||||
return found;
|
||||
}
|
||||
|
||||
// Try to start single circuit (un)blocking. Set a pending operation on success
|
||||
// @param force True to ignore resetting/(un)blocking flags of the circuit
|
||||
// Return built message to be sent on success
|
||||
|
|
|
@ -632,6 +632,17 @@ SignallingCircuitRange::SignallingCircuitRange(const String& rangeStr,
|
|||
add(rangeStr);
|
||||
}
|
||||
|
||||
// Allocate and return an array containing range circuits
|
||||
unsigned int* SignallingCircuitRange::copyRange(unsigned int& count) const
|
||||
{
|
||||
if (!m_count)
|
||||
return 0;
|
||||
count = m_count;
|
||||
unsigned int* tmp = new unsigned int[count];
|
||||
::memcpy(tmp,range(),m_range.length());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// Add codes to this range from a string
|
||||
bool SignallingCircuitRange::add(const String& rangeStr)
|
||||
{
|
||||
|
|
|
@ -1982,6 +1982,14 @@ public:
|
|||
inline const unsigned int* range() const
|
||||
{ return (const unsigned int*)m_range.data(); }
|
||||
|
||||
/**
|
||||
* Allocate and return an array containing range circuits
|
||||
* @param count Address of variable to be filled with circuit count
|
||||
* @return Pointer to allocated buffer, 0 if there is no circuit.
|
||||
* The caller will own the returned buffer
|
||||
*/
|
||||
unsigned int* copyRange(unsigned int& count) const;
|
||||
|
||||
/**
|
||||
* Get the pointer to the circuit codes array
|
||||
* @return Pointer to the circuit codes array or 0
|
||||
|
@ -8846,6 +8854,9 @@ private:
|
|||
bool transmitMessages(ObjList& list);
|
||||
// Handle circuit(s) (un)block command
|
||||
bool handleCicBlockCommand(const NamedList& p, bool block);
|
||||
// Handle remote circuit(s) (un)block command
|
||||
bool handleCicBlockRemoteCommand(const NamedList& p, unsigned int* cics,
|
||||
unsigned int count, bool block);
|
||||
// Try to start single circuit (un)blocking. Set a pending operation on success
|
||||
// @param force True to ignore resetting/(un)blocking flags of the circuit
|
||||
// Return built message to be sent on success
|
||||
|
|
Loading…
Reference in New Issue