Added capability to add a data consumer so decoders can be tested.
git-svn-id: http://voip.null.ro/svn/yate@1171 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
2948a5688a
commit
bd2245733b
|
@ -53,6 +53,7 @@ public:
|
|||
void ringing();
|
||||
void answered();
|
||||
void makeSource();
|
||||
void makeConsumer();
|
||||
inline const String& status() const
|
||||
{ return m_status; }
|
||||
inline const String& party() const
|
||||
|
@ -73,6 +74,13 @@ private:
|
|||
u_int64_t m_finish;
|
||||
};
|
||||
|
||||
class DummyConsumer : public DataConsumer
|
||||
{
|
||||
public:
|
||||
virtual void Consume(const DataBlock& data, unsigned long tStamp)
|
||||
{ }
|
||||
};
|
||||
|
||||
class GenThread : public Thread
|
||||
{
|
||||
public:
|
||||
|
@ -261,8 +269,10 @@ void GenConnection::ringing()
|
|||
++s_ringing;
|
||||
bool media =s_cfg.getBoolValue("parameters","earlymedia",true);
|
||||
s_mutex.unlock();
|
||||
if (media)
|
||||
if (media) {
|
||||
makeSource();
|
||||
makeConsumer();
|
||||
}
|
||||
}
|
||||
|
||||
void GenConnection::answered()
|
||||
|
@ -273,6 +283,7 @@ void GenConnection::answered()
|
|||
++s_answers;
|
||||
s_mutex.unlock();
|
||||
makeSource();
|
||||
makeConsumer();
|
||||
}
|
||||
|
||||
void GenConnection::makeSource()
|
||||
|
@ -286,11 +297,36 @@ void GenConnection::makeSource()
|
|||
Message m("chan.attach");
|
||||
m.addParam("id",id());
|
||||
m.addParam("source",src);
|
||||
m.addParam("single",String::boolText(true));
|
||||
m.userData(this);
|
||||
Engine::dispatch(m);
|
||||
}
|
||||
}
|
||||
|
||||
void GenConnection::makeConsumer()
|
||||
{
|
||||
if (getConsumer())
|
||||
return;
|
||||
s_mutex.lock();
|
||||
String cons(s_cfg.getValue("parameters","consumer"));
|
||||
s_mutex.unlock();
|
||||
if (cons) {
|
||||
if ((cons == "dummy") || (cons == "*")) {
|
||||
DummyConsumer* dummy = new DummyConsumer;
|
||||
setConsumer(dummy);
|
||||
dummy->deref();
|
||||
}
|
||||
else {
|
||||
Message m("chan.attach");
|
||||
m.addParam("id",id());
|
||||
m.addParam("consumer",cons);
|
||||
m.addParam("single",String::boolText(true));
|
||||
m.userData(this);
|
||||
Engine::dispatch(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnHandler::received(Message &msg, int id)
|
||||
{
|
||||
String callid(msg.getValue("targetid"));
|
||||
|
|
Loading…
Reference in New Issue