Use a message to support special TDM connection modes not implemented internally.
git-svn-id: http://yate.null.ro/svn/yate/trunk@3237 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
007be2f8a7
commit
155c2c669c
|
@ -326,6 +326,7 @@ public:
|
|||
virtual ~WpCircuit();
|
||||
virtual bool status(Status newStat, bool sync = false);
|
||||
virtual bool updateFormat(const char* format, int direction);
|
||||
virtual bool setParam(const String& param, const String& value);
|
||||
virtual void* getObject(const String& name) const;
|
||||
inline bool validSource()
|
||||
{ return 0 != m_sourceValid; }
|
||||
|
@ -343,6 +344,7 @@ private:
|
|||
WpConsumer* m_consumerValid; // Circuit's consumer if reserved, otherwise: 0
|
||||
WpSource* m_source;
|
||||
WpConsumer* m_consumer;
|
||||
String m_specialMode;
|
||||
};
|
||||
|
||||
// Wanpipe B-channel group
|
||||
|
@ -1200,6 +1202,9 @@ bool WpCircuit::status(Status newStat, bool sync)
|
|||
case Disabled:
|
||||
case Idle:
|
||||
case Reserved:
|
||||
m_specialMode.clear();
|
||||
// fall through
|
||||
case Special:
|
||||
case Connected:
|
||||
break;
|
||||
default: ;
|
||||
|
@ -1221,7 +1226,7 @@ bool WpCircuit::status(Status newStat, bool sync)
|
|||
// Enable/disable data transfer
|
||||
clearEvents();
|
||||
bool enableData = false;
|
||||
if (SignallingCircuit::status() == Connected)
|
||||
if (SignallingCircuit::status() >= Special)
|
||||
enableData = true;
|
||||
// Don't put this message for final states
|
||||
if (!Engine::exiting())
|
||||
|
@ -1230,6 +1235,17 @@ bool WpCircuit::status(Status newStat, bool sync)
|
|||
if (enableData) {
|
||||
m_sourceValid = m_source;
|
||||
m_consumerValid = m_consumer;
|
||||
if (newStat == Special) {
|
||||
Message m("circuit.special");
|
||||
m.userData(this);
|
||||
if (group())
|
||||
m.addParam("group",group()->toString());
|
||||
if (span())
|
||||
m.addParam("span",span()->toString());
|
||||
if (m_specialMode)
|
||||
m.addParam("mode",m_specialMode);
|
||||
return Engine::dispatch(m);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Disable data if not already disabled
|
||||
|
@ -1287,6 +1303,15 @@ bool WpCircuit::updateFormat(const char* format, int direction)
|
|||
return consumerChanged && sourceChanged;
|
||||
}
|
||||
|
||||
bool WpCircuit::setParam(const String& param, const String& value)
|
||||
{
|
||||
if (param == "special_mode")
|
||||
m_specialMode = value;
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get source or consumer
|
||||
void* WpCircuit::getObject(const String& name) const
|
||||
{
|
||||
|
|
|
@ -625,6 +625,7 @@ protected:
|
|||
ZapDevice m_device; // The device
|
||||
ZapDevice::Type m_type; // Circuit type
|
||||
ZapDevice::Format m_format; // The data format
|
||||
String m_specialMode; // Special test mode
|
||||
bool m_echoCancel; // Echo canceller state
|
||||
bool m_crtEchoCancel; // Current echo canceller state
|
||||
unsigned int m_echoTaps; // Echo cancel taps
|
||||
|
@ -2316,6 +2317,10 @@ bool ZapCircuit::setParam(const String& param, const String& value)
|
|||
m_crtDtmfDetect = ok;
|
||||
return ok;
|
||||
}
|
||||
if (param == "special_mode") {
|
||||
m_specialMode = value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2414,7 +2419,7 @@ bool ZapCircuit::sendEvent(SignallingCircuitEvent::Type type, NamedList* params)
|
|||
// Consume data sent by the consumer
|
||||
void ZapCircuit::consume(const DataBlock& data)
|
||||
{
|
||||
if (!(SignallingCircuit::status() == Connected && m_canSend && data.length()))
|
||||
if (!(SignallingCircuit::status() >= Special && m_canSend && data.length()))
|
||||
return;
|
||||
|
||||
// Copy data in buffer
|
||||
|
@ -2476,6 +2481,7 @@ void ZapCircuit::cleanup(bool release, Status stat, bool stop)
|
|||
return;
|
||||
}
|
||||
status(stat);
|
||||
m_specialMode.clear();
|
||||
m_sourceBuffer.clear();
|
||||
m_consBuffer.clear();
|
||||
m_consErrors = m_consErrorBytes = m_consTotal = 0;
|
||||
|
@ -2616,6 +2622,7 @@ bool ZapAnalogCircuit::status(Status newStat, bool sync)
|
|||
case Disabled:
|
||||
case Idle:
|
||||
case Reserved:
|
||||
case Special:
|
||||
case Connected:
|
||||
break;
|
||||
default: ;
|
||||
|
@ -2633,7 +2640,7 @@ bool ZapAnalogCircuit::status(Status newStat, bool sync)
|
|||
DDebug(group(),DebugAll,"ZapCircuit(%u). Changed status to %u [%p]",
|
||||
code(),newStat,this);
|
||||
|
||||
if (newStat != Connected && m_device.valid())
|
||||
if (newStat < Special && m_device.valid())
|
||||
m_device.flushBuffers();
|
||||
|
||||
if (newStat == Reserved) {
|
||||
|
@ -2653,12 +2660,25 @@ bool ZapAnalogCircuit::status(Status newStat, bool sync)
|
|||
}
|
||||
return SignallingCircuit::status() == Reserved;
|
||||
}
|
||||
else if (newStat == Connected) {
|
||||
if (m_device.valid())
|
||||
else if (newStat >= Special) {
|
||||
if (m_device.valid()) {
|
||||
createData();
|
||||
if (newStat == Special) {
|
||||
Message m("circuit.special");
|
||||
m.userData(this);
|
||||
if (group())
|
||||
m.addParam("group",group()->toString());
|
||||
if (span())
|
||||
m.addParam("span",span()->toString());
|
||||
if (m_specialMode)
|
||||
m.addParam("mode",m_specialMode);
|
||||
if (!Engine::dispatch(m))
|
||||
cleanup(false,Idle,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
cleanup(false,Idle,true);
|
||||
return SignallingCircuit::status() == Connected;
|
||||
return SignallingCircuit::status() == newStat;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue