Added possibility to track message progress through handlers.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5107 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
257d20c738
commit
bf57830c7f
|
@ -20,6 +20,10 @@
|
|||
; and message relays are flushed, valid range 1-100 ms
|
||||
;waitflush=5
|
||||
|
||||
; trackparam: bool: Add the external module to the handler tracking parameter
|
||||
; The default of false lets each external script do so
|
||||
;trackparam=false
|
||||
|
||||
|
||||
;[listener sample]
|
||||
; For each socket listener there should be a section starting with the
|
||||
|
|
|
@ -95,6 +95,10 @@
|
|||
; Values are clamped to interval 5-100
|
||||
;maxdepth=5
|
||||
|
||||
; trackparam: bool: Add the module to the handler tracking parameter
|
||||
; The default of false lets each section do so
|
||||
;trackparam=false
|
||||
|
||||
|
||||
[$once]
|
||||
; First-time only global variables initialization.
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
; version and currently running programs
|
||||
;wintimer=0
|
||||
|
||||
; trackparam: string: Name of the parameter used to track message through handlers
|
||||
; If empty or boolean true the default "handlers" will be used instead
|
||||
; Set to boolean false to disable tracking only if you are sure what you want
|
||||
;trackparam=handlers
|
||||
|
||||
; msgsniff: bool: Activate message sniffer module (if loaded) at engine init time
|
||||
;msgsniff=disable
|
||||
|
||||
|
|
|
@ -983,7 +983,7 @@ bool Module::installRelay(int id, const char* name, unsigned priority)
|
|||
return true;
|
||||
m_relays |= id;
|
||||
|
||||
MessageRelay* relay = new MessageRelay(name,this,id,priority);
|
||||
MessageRelay* relay = new MessageRelay(name,this,id,priority,Module::name());
|
||||
m_relayList.append(relay)->setDelete(false);
|
||||
Engine::install(relay);
|
||||
return true;
|
||||
|
|
|
@ -2414,7 +2414,7 @@ void Client::installRelay(const char* name, int id, int prio)
|
|||
if (!(name && *name))
|
||||
return;
|
||||
Debug(ClientDriver::self(),DebugAll,"installRelay(%s,%d,%d)",name,id,prio);
|
||||
MessageRelay* relay = new MessageRelay(name,this,id,prio);
|
||||
MessageRelay* relay = new MessageRelay(name,this,id,prio,ClientDriver::self()->name(),true);
|
||||
if (Engine::install(relay))
|
||||
m_relays.append(relay);
|
||||
else
|
||||
|
|
|
@ -103,7 +103,9 @@ public:
|
|||
class EngineCommand : public MessageHandler
|
||||
{
|
||||
public:
|
||||
EngineCommand() : MessageHandler("engine.command") { }
|
||||
EngineCommand()
|
||||
: MessageHandler("engine.command",100,"engine")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
static void doCompletion(Message &msg, const String& partLine, const String& partWord);
|
||||
};
|
||||
|
@ -290,7 +292,10 @@ private:
|
|||
class EngineSuperHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
EngineSuperHandler() : MessageHandler("engine.timer",0), m_seq(0) { }
|
||||
EngineSuperHandler()
|
||||
: MessageHandler("engine.timer",0,"engine"),
|
||||
m_seq(0)
|
||||
{ }
|
||||
virtual bool received(Message &msg)
|
||||
{ ::write(s_super_handle,&m_seq,1); m_seq++; return false; }
|
||||
char m_seq;
|
||||
|
@ -299,14 +304,18 @@ public:
|
|||
class EngineStatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
EngineStatusHandler() : MessageHandler("engine.status",0) { }
|
||||
EngineStatusHandler()
|
||||
: MessageHandler("engine.status",0,"engine")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class EngineHelp : public MessageHandler
|
||||
{
|
||||
public:
|
||||
EngineHelp() : MessageHandler("engine.help") { }
|
||||
EngineHelp()
|
||||
: MessageHandler("engine.help",100,"engine")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -326,7 +335,9 @@ private:
|
|||
class EngineEventHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
EngineEventHandler() : MessageHandler("module.update",0) { }
|
||||
EngineEventHandler()
|
||||
: MessageHandler("module.update",0,"engine")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -1189,6 +1200,13 @@ int Engine::engineInit()
|
|||
CapturedEvent::capturing(s_capture);
|
||||
if (s_capture && s_startMsg)
|
||||
CapturedEvent::append(-1,s_startMsg);
|
||||
String track = s_cfg.getValue("general","trackparam");
|
||||
if (track.null() || track.toBoolean(false))
|
||||
track = "handlers";
|
||||
else if (!track.toBoolean(true))
|
||||
track.clear();
|
||||
if (track)
|
||||
m_dispatcher.trackParam(track);
|
||||
#ifdef _WINDOWS
|
||||
int winTimerRes = s_cfg.getIntValue("general","wintimer");
|
||||
if ((winTimerRes > 0) && (winTimerRes < 100)) {
|
||||
|
@ -1254,6 +1272,8 @@ int Engine::engineInit()
|
|||
#endif
|
||||
s_params.addParam("maxworkers",String(s_maxworkers));
|
||||
s_params.addParam("maxevents",String(s_maxevents));
|
||||
if (track)
|
||||
s_params.addParam("trackparam",track);
|
||||
#ifdef _WINDOWS
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
|
|
@ -211,12 +211,16 @@ int Message::commonDecode(const char* str, int offs)
|
|||
}
|
||||
|
||||
|
||||
MessageHandler::MessageHandler(const char* name, unsigned priority)
|
||||
MessageHandler::MessageHandler(const char* name, unsigned priority,
|
||||
const char* trackName, bool addPriority)
|
||||
: String(name),
|
||||
m_priority(priority), m_unsafe(0), m_dispatcher(0), m_filter(0)
|
||||
m_trackName(trackName), m_priority(priority),
|
||||
m_unsafe(0), m_dispatcher(0), m_filter(0)
|
||||
{
|
||||
DDebug(DebugAll,"MessageHandler::MessageHandler(\"%s\",%u) [%p]",
|
||||
name,priority,this);
|
||||
DDebug(DebugAll,"MessageHandler::MessageHandler('%s',%u,'%s',%s) [%p]",
|
||||
name,priority,trackName,String::boolText(addPriority),this);
|
||||
if (addPriority && priority && m_trackName)
|
||||
m_trackName << ":" << priority;
|
||||
}
|
||||
|
||||
MessageHandler::~MessageHandler()
|
||||
|
@ -280,11 +284,11 @@ bool MessageRelay::receivedInternal(Message& msg)
|
|||
}
|
||||
|
||||
|
||||
MessageDispatcher::MessageDispatcher()
|
||||
MessageDispatcher::MessageDispatcher(const char* trackParam)
|
||||
: Mutex(false,"MessageDispatcher"),
|
||||
m_changes(0), m_warnTime(0)
|
||||
m_trackParam(trackParam), m_changes(0), m_warnTime(0)
|
||||
{
|
||||
XDebug(DebugInfo,"MessageDispatcher::MessageDispatcher() [%p]",this);
|
||||
XDebug(DebugInfo,"MessageDispatcher::MessageDispatcher('%s') [%p]",trackParam,this);
|
||||
}
|
||||
|
||||
MessageDispatcher::~MessageDispatcher()
|
||||
|
@ -376,6 +380,9 @@ bool MessageDispatcher::dispatch(Message& msg)
|
|||
continue;
|
||||
unsigned int c = m_changes;
|
||||
unsigned int p = h->priority();
|
||||
String handlerName;
|
||||
if (trackParam())
|
||||
handlerName = h->trackName();
|
||||
// mark handler as unsafe to destroy / uninstall
|
||||
h->m_unsafe++;
|
||||
unlock();
|
||||
|
@ -389,6 +396,13 @@ bool MessageDispatcher::dispatch(Message& msg)
|
|||
Debug(DebugInfo,"Message '%s' [%p] passed through %p in " FMT64U " usec",
|
||||
msg.c_str(),&msg,h,tm);
|
||||
#endif
|
||||
if (handlerName) {
|
||||
NamedString* tracked = msg.getParam(trackParam());
|
||||
if (tracked)
|
||||
tracked->append(handlerName,",");
|
||||
else
|
||||
msg.addParam(trackParam(),handlerName);
|
||||
}
|
||||
if (retv && !msg.broadcast())
|
||||
break;
|
||||
lock();
|
||||
|
|
|
@ -106,9 +106,9 @@ bool ChanAssistList::received(Message& msg, int id, ChanAssist* assist)
|
|||
void ChanAssistList::init(int priority)
|
||||
{
|
||||
installRelay(Execute,priority);
|
||||
Engine::install(new MessageRelay("chan.startup",this,Startup,priority));
|
||||
Engine::install(new MessageRelay("chan.hangup",this,Hangup,priority));
|
||||
Engine::install(new MessageRelay("chan.disconnected",this,Disconnected,priority));
|
||||
Engine::install(new MessageRelay("chan.startup",this,Startup,priority,name()));
|
||||
Engine::install(new MessageRelay("chan.hangup",this,Hangup,priority,name()));
|
||||
Engine::install(new MessageRelay("chan.disconnected",this,Disconnected,priority,name()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,8 +90,9 @@ CallInfo* CallList::find(const CallEndpoint* call)
|
|||
}
|
||||
|
||||
|
||||
MultiRouter::MultiRouter()
|
||||
MultiRouter::MultiRouter(const char* trackName)
|
||||
: Mutex(true,"MultiRouter"),
|
||||
m_trackName(trackName),
|
||||
m_relRoute(0), m_relExecute(0),
|
||||
m_relHangup(0), m_relDisconnected(0)
|
||||
{
|
||||
|
@ -110,13 +111,17 @@ void MultiRouter::setup(int priority)
|
|||
if (priority <= 0)
|
||||
priority = 20;
|
||||
if (!m_relHangup)
|
||||
Engine::install(m_relHangup = new MessageRelay("chan.hangup",this,Hangup,priority));
|
||||
Engine::install(m_relHangup =
|
||||
new MessageRelay("chan.hangup",this,Hangup,priority,m_trackName));
|
||||
if (!m_relDisconnected)
|
||||
Engine::install(m_relDisconnected = new MessageRelay("chan.disconnected",this,Disconnected,priority));
|
||||
Engine::install(m_relDisconnected =
|
||||
new MessageRelay("chan.disconnected",this,Disconnected,priority,m_trackName));
|
||||
if (!m_relExecute)
|
||||
Engine::install(m_relExecute = new MessageRelay("call.execute",this,Execute,priority));
|
||||
Engine::install(m_relExecute =
|
||||
new MessageRelay("call.execute",this,Execute,priority,m_trackName));
|
||||
if (!m_relRoute)
|
||||
Engine::install(m_relRoute = new MessageRelay("call.route",this,Route,priority));
|
||||
Engine::install(m_relRoute =
|
||||
new MessageRelay("call.route",this,Route,priority,m_trackName));
|
||||
}
|
||||
|
||||
bool MultiRouter::received(Message& msg, int id)
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
Hangup,
|
||||
Disconnected
|
||||
};
|
||||
MultiRouter();
|
||||
MultiRouter(const char* trackName = 0);
|
||||
virtual ~MultiRouter();
|
||||
void setup(int priority = 0);
|
||||
virtual bool received(Message& msg, int id);
|
||||
|
@ -119,6 +119,7 @@ public:
|
|||
protected:
|
||||
CallList m_list;
|
||||
private:
|
||||
String m_trackName;
|
||||
MessageRelay* m_relRoute;
|
||||
MessageRelay* m_relExecute;
|
||||
MessageRelay* m_relHangup;
|
||||
|
|
|
@ -150,12 +150,7 @@ protected:
|
|||
String m_window;
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
class AttachHandler;
|
||||
|
||||
class AnalyzerDriver : public Driver
|
||||
{
|
||||
|
@ -188,6 +183,15 @@ static Mutex s_mutex(false,"Analyzer");
|
|||
|
||||
static int s_res = 1;
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
static const char* printTime(char* buf,unsigned long usec)
|
||||
{
|
||||
switch (s_res) {
|
||||
|
|
|
@ -115,17 +115,6 @@ protected:
|
|||
bool m_hasRelays;
|
||||
};
|
||||
|
||||
class ForkRelay : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ForkRelay(const char* name, const char* match, int priority)
|
||||
: MessageHandler(name,priority),
|
||||
m_match(match)
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
private:
|
||||
String m_match;
|
||||
};
|
||||
|
||||
static TokenDict s_calltypes[] = {
|
||||
{ "regular", ForkSlave::Regular },
|
||||
|
@ -144,6 +133,20 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
}
|
||||
|
||||
|
||||
class ForkRelay : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ForkRelay(const char* name, const char* match, int priority)
|
||||
: MessageHandler(name,priority,__plugin.name()),
|
||||
m_match(match)
|
||||
{ }
|
||||
virtual bool received(Message& msg)
|
||||
{ return __plugin.msgToSlaves(msg,m_match); }
|
||||
private:
|
||||
String m_match;
|
||||
};
|
||||
|
||||
|
||||
ForkMaster::ForkMaster(ObjList* targets)
|
||||
: m_index(0), m_answered(false), m_rtpForward(false), m_rtpStrict(false),
|
||||
m_fake(false), m_targets(targets), m_exec(0),
|
||||
|
@ -639,12 +642,6 @@ void ForkSlave::disconnected(bool final, const char* reason)
|
|||
}
|
||||
|
||||
|
||||
bool ForkRelay::received(Message& msg)
|
||||
{
|
||||
return __plugin.msgToSlaves(msg,m_match);
|
||||
}
|
||||
|
||||
|
||||
ForkModule::ForkModule()
|
||||
: Module("callfork","misc"),
|
||||
m_hasRelays(false)
|
||||
|
|
|
@ -636,15 +636,15 @@ void CallGenPlugin::initialize()
|
|||
m_first = false;
|
||||
|
||||
ConnHandler* coh = new ConnHandler;
|
||||
Engine::install(new MessageRelay("call.ringing",coh,ConnHandler::Ringing));
|
||||
Engine::install(new MessageRelay("call.answered",coh,ConnHandler::Answered));
|
||||
Engine::install(new MessageRelay("call.execute",coh,ConnHandler::Execute));
|
||||
Engine::install(new MessageRelay("call.drop",coh,ConnHandler::Drop));
|
||||
Engine::install(new MessageRelay("call.ringing",coh,ConnHandler::Ringing,100,name()));
|
||||
Engine::install(new MessageRelay("call.answered",coh,ConnHandler::Answered,100,name()));
|
||||
Engine::install(new MessageRelay("call.execute",coh,ConnHandler::Execute,100,name()));
|
||||
Engine::install(new MessageRelay("call.drop",coh,ConnHandler::Drop,100,name()));
|
||||
|
||||
CmdHandler* cmh = new CmdHandler;
|
||||
Engine::install(new MessageRelay("engine.status",cmh,CmdHandler::Status));
|
||||
Engine::install(new MessageRelay("engine.command",cmh,CmdHandler::Command));
|
||||
Engine::install(new MessageRelay("engine.help",cmh,CmdHandler::Help));
|
||||
Engine::install(new MessageRelay("engine.status",cmh,CmdHandler::Status,100,name()));
|
||||
Engine::install(new MessageRelay("engine.command",cmh,CmdHandler::Command,100,name()));
|
||||
Engine::install(new MessageRelay("engine.help",cmh,CmdHandler::Help,100,name()));
|
||||
|
||||
CleanThread* cln = new CleanThread;
|
||||
if (!cln->startup()) {
|
||||
|
|
|
@ -43,11 +43,25 @@ enum {
|
|||
EngHalt
|
||||
};
|
||||
|
||||
class CdrBuildPlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
CdrBuildPlugin();
|
||||
virtual ~CdrBuildPlugin();
|
||||
virtual void initialize();
|
||||
private:
|
||||
bool m_first;
|
||||
};
|
||||
|
||||
INIT_PLUGIN(CdrBuildPlugin);
|
||||
|
||||
class CdrHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CdrHandler(const char *name, int type, int prio = 50)
|
||||
: MessageHandler(name,prio), m_type(type) { }
|
||||
: MessageHandler(name,prio,__plugin.name()),
|
||||
m_type(type)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
private:
|
||||
int m_type;
|
||||
|
@ -56,14 +70,18 @@ private:
|
|||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler() : MessageHandler("engine.status") { }
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class CommandHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CommandHandler() : MessageHandler("engine.command") { }
|
||||
CommandHandler()
|
||||
: MessageHandler("engine.command",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -530,16 +548,6 @@ bool CommandHandler::received(Message &msg)
|
|||
}
|
||||
|
||||
|
||||
class CdrBuildPlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
CdrBuildPlugin();
|
||||
virtual ~CdrBuildPlugin();
|
||||
virtual void initialize();
|
||||
private:
|
||||
bool m_first;
|
||||
};
|
||||
|
||||
CdrBuildPlugin::CdrBuildPlugin()
|
||||
: Plugin("cdrbuild"),
|
||||
m_first(true)
|
||||
|
@ -609,8 +617,6 @@ void CdrBuildPlugin::initialize()
|
|||
}
|
||||
}
|
||||
|
||||
INIT_PLUGIN(CdrBuildPlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -39,11 +39,26 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
class CdrFileHandler;
|
||||
|
||||
class CdrFilePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
CdrFilePlugin();
|
||||
~CdrFilePlugin();
|
||||
virtual void initialize();
|
||||
private:
|
||||
CdrFileHandler *m_handler;
|
||||
};
|
||||
|
||||
INIT_PLUGIN(CdrFilePlugin);
|
||||
|
||||
class CdrFileHandler : public MessageHandler, public Mutex
|
||||
{
|
||||
public:
|
||||
CdrFileHandler(const char *name)
|
||||
: MessageHandler(name), Mutex(false,"CdrFileHandler"),
|
||||
: MessageHandler(name,100,__plugin.name()),
|
||||
Mutex(false,"CdrFileHandler"),
|
||||
m_file(-1)
|
||||
{ }
|
||||
virtual ~CdrFileHandler();
|
||||
|
@ -103,16 +118,6 @@ bool CdrFileHandler::received(Message &msg)
|
|||
return false;
|
||||
};
|
||||
|
||||
class CdrFilePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
CdrFilePlugin();
|
||||
~CdrFilePlugin();
|
||||
virtual void initialize();
|
||||
private:
|
||||
CdrFileHandler *m_handler;
|
||||
};
|
||||
|
||||
CdrFilePlugin::CdrFilePlugin()
|
||||
: Plugin("cdrfile",true),
|
||||
m_handler(0)
|
||||
|
@ -139,8 +144,6 @@ void CdrFilePlugin::initialize()
|
|||
m_handler->init(file,cfg.getBoolValue("general","tabs",true),cfg.getValue("general","format"));
|
||||
}
|
||||
|
||||
INIT_PLUGIN(CdrFilePlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -119,40 +119,7 @@ private:
|
|||
unsigned int m_rate;
|
||||
};
|
||||
|
||||
class AlsaHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AlsaHandler(const char *name) : MessageHandler(name) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler() : MessageHandler("engine.status") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DropHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DropHandler(const char *name) : MessageHandler(name) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MasqHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MasqHandler(const char *name, int prio) : MessageHandler(name,prio) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
class AlsaHandler;
|
||||
|
||||
class AlsaPlugin : public Plugin
|
||||
{
|
||||
|
@ -164,6 +131,53 @@ private:
|
|||
AlsaHandler *m_handler;
|
||||
};
|
||||
|
||||
INIT_PLUGIN(AlsaPlugin);
|
||||
|
||||
class AlsaHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AlsaHandler(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DropHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DropHandler(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MasqHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MasqHandler(const char *name, int prio)
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
AlsaChan *s_chan = 0;
|
||||
AlsaDevice* s_dev = 0;
|
||||
|
||||
|
@ -703,8 +717,6 @@ bool AlsaPlugin::isBusy() const
|
|||
return (s_dev != 0);
|
||||
}
|
||||
|
||||
INIT_PLUGIN(AlsaPlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
// input sample rate
|
||||
unsigned int m_rate;
|
||||
};
|
||||
|
||||
|
||||
class CoreAudioChan : public CallEndpoint
|
||||
{
|
||||
public:
|
||||
|
@ -146,42 +146,9 @@ private:
|
|||
String m_target;
|
||||
unsigned int m_rate;
|
||||
};
|
||||
|
||||
class CoreAudioHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CoreAudioHandler(const char *name) : MessageHandler(name) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler() : MessageHandler("engine.status") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DropHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DropHandler() : MessageHandler("call.drop") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MasqHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MasqHandler(int prio) : MessageHandler("chan.masquerade",prio) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
class CoreAudioHandler;
|
||||
|
||||
class CoreAudioPlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
|
@ -191,11 +158,56 @@ public:
|
|||
private:
|
||||
CoreAudioHandler* m_handler;
|
||||
};
|
||||
|
||||
|
||||
static CoreAudioChan* s_audioChan = 0;
|
||||
|
||||
INIT_PLUGIN(CoreAudioPlugin);
|
||||
|
||||
class CoreAudioHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CoreAudioHandler(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DropHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DropHandler()
|
||||
: MessageHandler("call.drop",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MasqHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MasqHandler(int prio)
|
||||
: MessageHandler("chan.masquerade",prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// test if a device permits setting the volume
|
||||
static bool checkVolumeSettable(AudioDeviceID devId, UInt32 inChannel,Boolean isInput)
|
||||
{
|
||||
|
|
|
@ -136,13 +136,7 @@ public:
|
|||
virtual ~DSoundChan();
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
class AttachHandler;
|
||||
|
||||
class SoundDriver : public Driver
|
||||
{
|
||||
|
@ -160,6 +154,15 @@ private:
|
|||
|
||||
INIT_PLUGIN(SoundDriver);
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
DSoundPlay::DSoundPlay(DSoundConsumer* owner, DWORD rate, LPGUID device)
|
||||
: Thread("DirectSound Play",High), Mutex(false,"DSoundPlay"),
|
||||
|
|
|
@ -2497,8 +2497,8 @@ Message* StreamData::message(const char* msg, NamedList& req, bool ok, XmlElemen
|
|||
* JBMessageHandler
|
||||
*/
|
||||
JBMessageHandler::JBMessageHandler(int handler)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),handler < 0 ? 100 : handler),
|
||||
m_handler(handler)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),handler < 0 ? 100 : handler,__plugin.name()),
|
||||
m_handler(handler)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -123,40 +123,7 @@ private:
|
|||
unsigned int m_rate;
|
||||
};
|
||||
|
||||
class OssHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
OssHandler(const char *name) : MessageHandler(name) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler() : MessageHandler("engine.status") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DropHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DropHandler(const char *name) : MessageHandler(name) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MasqHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MasqHandler(const char *name, int prio) : MessageHandler(name,prio) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
class OssHandler;
|
||||
|
||||
class OssPlugin : public Plugin
|
||||
{
|
||||
|
@ -168,6 +135,53 @@ private:
|
|||
OssHandler *m_handler;
|
||||
};
|
||||
|
||||
INIT_PLUGIN(OssPlugin);
|
||||
|
||||
class OssHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
OssHandler(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DropHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DropHandler(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MasqHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MasqHandler(const char *name, int prio)
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
OssChan *s_chan = 0;
|
||||
|
||||
|
||||
|
@ -690,8 +704,6 @@ bool OssPlugin::isBusy() const
|
|||
return (s_chan != 0);
|
||||
}
|
||||
|
||||
INIT_PLUGIN(OssPlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -244,30 +244,6 @@ private:
|
|||
RefPointer<ConfConsumer> m_cons;
|
||||
};
|
||||
|
||||
// Handler for call.conference message to join both legs of a call in conference
|
||||
class ConfHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ConfHandler(unsigned int priority)
|
||||
: MessageHandler("call.conference",priority)
|
||||
{ }
|
||||
virtual ~ConfHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// Handler for chan.hangup message
|
||||
class HangupHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline HangupHandler(unsigned int priority)
|
||||
: MessageHandler("chan.hangup",priority)
|
||||
{ }
|
||||
virtual ~HangupHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// The driver just holds all the channels (not conferences)
|
||||
class ConferenceDriver : public Driver
|
||||
{
|
||||
|
@ -299,6 +275,30 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Handler for call.conference message to join both legs of a call in conference
|
||||
class ConfHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ConfHandler(unsigned int priority)
|
||||
: MessageHandler("call.conference",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~ConfHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// Handler for chan.hangup message
|
||||
class HangupHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline HangupHandler(unsigned int priority)
|
||||
: MessageHandler("chan.hangup",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~HangupHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// Count the position of the most significant 1 bit - pretty close to logarithm
|
||||
static unsigned int binLog(unsigned int x)
|
||||
{
|
||||
|
|
|
@ -32,18 +32,6 @@ namespace { // anonymous
|
|||
#define ENUM_DEF_MINLEN 8
|
||||
#define ENUM_DEF_MAXCALL 30000
|
||||
|
||||
class EnumHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EnumHandler(unsigned int prio = 90)
|
||||
: MessageHandler("call.route",prio)
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
private:
|
||||
static bool resolve(Message& msg,bool canRedirect);
|
||||
static void addRoute(String& dest,const String& src);
|
||||
};
|
||||
|
||||
class EnumModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -83,6 +71,18 @@ static int s_reroute = 0;
|
|||
|
||||
static EnumModule emodule;
|
||||
|
||||
class EnumHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EnumHandler(unsigned int prio = 90)
|
||||
: MessageHandler("call.route",prio,emodule.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
private:
|
||||
static bool resolve(Message& msg,bool canRedirect);
|
||||
static void addRoute(String& dest,const String& src);
|
||||
};
|
||||
|
||||
|
||||
// Routing message handler, performs checks and calls resolve method
|
||||
bool EnumHandler::received(Message& msg)
|
||||
|
|
|
@ -63,6 +63,7 @@ static int s_waitFlush = WAIT_FLUSH;
|
|||
static int s_timeout = MSG_TIMEOUT;
|
||||
static bool s_timebomb = false;
|
||||
static bool s_pluginSafe = true;
|
||||
static const char* s_trackName = 0;
|
||||
|
||||
static const char* s_cmds[] = {
|
||||
"info",
|
||||
|
@ -280,17 +281,36 @@ private:
|
|||
ExtModReceiver* m_receiver;
|
||||
};
|
||||
|
||||
class ExtModHandler;
|
||||
|
||||
class ExtModulePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
ExtModulePlugin();
|
||||
~ExtModulePlugin();
|
||||
virtual void initialize();
|
||||
virtual bool isBusy() const;
|
||||
private:
|
||||
ExtModHandler *m_handler;
|
||||
};
|
||||
|
||||
INIT_PLUGIN(ExtModulePlugin);
|
||||
|
||||
class ExtModHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ExtModHandler(const char *name, unsigned prio) : MessageHandler(name,prio) { }
|
||||
ExtModHandler(const char *name, unsigned prio)
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class ExtModCommand : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ExtModCommand(const char *name) : MessageHandler(name) { }
|
||||
ExtModCommand(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
private:
|
||||
bool complete(const String& partLine, const String& partWord, String& rval) const;
|
||||
|
@ -311,17 +331,6 @@ protected:
|
|||
int m_role;
|
||||
};
|
||||
|
||||
class ExtModulePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
ExtModulePlugin();
|
||||
~ExtModulePlugin();
|
||||
virtual void initialize();
|
||||
virtual bool isBusy() const;
|
||||
private:
|
||||
ExtModHandler *m_handler;
|
||||
};
|
||||
|
||||
|
||||
static bool runProgram(const char *script, const char *args)
|
||||
{
|
||||
|
@ -1287,7 +1296,7 @@ bool ExtModReceiver::processLine(const char* line)
|
|||
lock();
|
||||
bool ok = id && !m_dead && !m_relays.find(id);
|
||||
if (ok) {
|
||||
MessageRelay *r = new MessageRelay(id,this,0,prio);
|
||||
MessageRelay *r = new MessageRelay(id,this,0,prio,s_trackName);
|
||||
if (fname)
|
||||
r->setFilter(fname,fvalue);
|
||||
m_relays.append(r);
|
||||
|
@ -1826,6 +1835,8 @@ void ExtModulePlugin::initialize()
|
|||
s_cfg.load();
|
||||
s_timeout = s_cfg.getIntValue("general","timeout",MSG_TIMEOUT);
|
||||
s_timebomb = s_cfg.getBoolValue("general","timebomb",false);
|
||||
s_trackName = s_cfg.getBoolValue("general","trackparam",false) ?
|
||||
name().c_str() : (const char*)0;
|
||||
int wf = s_cfg.getIntValue("general","waitflush",WAIT_FLUSH);
|
||||
if (wf < 1)
|
||||
wf = 1;
|
||||
|
@ -1869,8 +1880,6 @@ void ExtModulePlugin::initialize()
|
|||
}
|
||||
}
|
||||
|
||||
INIT_PLUGIN(ExtModulePlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -212,13 +212,6 @@ private:
|
|||
int m_pages;
|
||||
};
|
||||
|
||||
class FaxHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
FaxHandler(const char *name) : MessageHandler(name) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// Driver and plugin
|
||||
class FaxDriver : public Driver
|
||||
{
|
||||
|
@ -241,6 +234,15 @@ static const TokenDict s_types[] = {
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
class FaxHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
FaxHandler(const char *name)
|
||||
: MessageHandler(name,100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
FaxSource::FaxSource(FaxWrapper* wrapper, const char* format)
|
||||
: DataSource(format), m_wrap(wrapper)
|
||||
{
|
||||
|
|
|
@ -612,7 +612,7 @@ class UserHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
UserHandler()
|
||||
: MessageHandler("user.login",140)
|
||||
: MessageHandler("user.login",140,hplugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
|
|
@ -3812,8 +3812,8 @@ void UserAuthMessage::authFailed()
|
|||
* JBMessageHandler
|
||||
*/
|
||||
JBMessageHandler::JBMessageHandler(int handler)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),handler < 0 ? 100 : handler),
|
||||
m_handler(handler)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),handler < 0 ? 100 : handler,__plugin.name()),
|
||||
m_handler(handler)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -762,7 +762,7 @@ void JsModule::init(int priority)
|
|||
installRelay(Route,priority);
|
||||
installRelay(Ringing,priority);
|
||||
installRelay(Answered,priority);
|
||||
Engine::install(new MessageRelay("call.preroute",this,Preroute,priority));
|
||||
Engine::install(new MessageRelay("call.preroute",this,Preroute,priority,name()));
|
||||
}
|
||||
|
||||
}; // anonymous namespace
|
||||
|
|
|
@ -86,26 +86,7 @@ private:
|
|||
static int s_nextid;
|
||||
};
|
||||
|
||||
class MOHHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MOHHandler() : MessageHandler("call.execute") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler() : MessageHandler("engine.status") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
class MOHHandler;
|
||||
|
||||
class MOHPlugin : public Plugin
|
||||
{
|
||||
|
@ -117,6 +98,35 @@ private:
|
|||
MOHHandler *m_handler;
|
||||
};
|
||||
|
||||
INIT_PLUGIN(MOHPlugin);
|
||||
|
||||
class MOHHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MOHHandler()
|
||||
: MessageHandler("call.execute",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
MOHSource::MOHSource(const String &name, const String &command_line, unsigned int rate)
|
||||
: ThreadedSource("slin"),
|
||||
|
@ -458,8 +468,6 @@ void MOHPlugin::initialize()
|
|||
}
|
||||
}
|
||||
|
||||
INIT_PLUGIN(MOHPlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -139,16 +139,6 @@ private:
|
|||
ObjList m_sources; // Source list
|
||||
};
|
||||
|
||||
// chan.attach handler
|
||||
class ChanAttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanAttachHandler()
|
||||
: MessageHandler("chan.attach",100)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Module data and function
|
||||
|
@ -159,6 +149,16 @@ static unsigned char s_idleValue; // Idle value for source multiplexer to
|
|||
static String s_defFormat; // Default format for MuxSource
|
||||
static MuxModule plugin;
|
||||
|
||||
// chan.attach handler
|
||||
class ChanAttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanAttachHandler()
|
||||
: MessageHandler("chan.attach",100,plugin.name())
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// Dictionary containig the supported formats and sample lengths
|
||||
static TokenDict s_dictSampleLen[] = {
|
||||
{"mulaw", 1},
|
||||
|
|
|
@ -118,15 +118,6 @@ private:
|
|||
SSL* m_ssl;
|
||||
};
|
||||
|
||||
class SslHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline SslHandler()
|
||||
: MessageHandler("socket.ssl")
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
#ifndef OPENSSL_NO_AES
|
||||
// AES Counter Mode
|
||||
class AesCtrCipher : public Cipher
|
||||
|
@ -189,6 +180,8 @@ public:
|
|||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class SslHandler;
|
||||
|
||||
class OpenSSL : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -216,6 +209,15 @@ static int s_index = -1;
|
|||
static SSL_CTX* s_context = 0;
|
||||
static OpenSSL __plugin;
|
||||
|
||||
class SslHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline SslHandler()
|
||||
: MessageHandler("socket.ssl",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
// Attempt to add randomness from system time when called
|
||||
static void addRand(u_int64_t usec)
|
||||
|
|
|
@ -27,46 +27,6 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
// chan.connect handler used to connect two channels
|
||||
class ConnHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ConnHandler(int prio = 90)
|
||||
: MessageHandler("chan.connect",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// call.execute handler used to 'steal' a channel
|
||||
class ChanPickup : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ChanPickup(int prio = 100)
|
||||
: MessageHandler("call.execute",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// chan.attach handler used for detaching data nodes by message
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler(int prio = 100)
|
||||
: MessageHandler("chan.attach",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// chan.record handler used for detaching data nodes by message
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler(int prio = 100)
|
||||
: MessageHandler("chan.record",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class PbxModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -81,6 +41,47 @@ static PbxModule s_module;
|
|||
static const String s_masquerade("chan.masquerade");
|
||||
|
||||
|
||||
// chan.connect handler used to connect two channels
|
||||
class ConnHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ConnHandler(int prio = 90)
|
||||
: MessageHandler("chan.connect",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// call.execute handler used to 'steal' a channel
|
||||
class ChanPickup : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ChanPickup(int prio = 100)
|
||||
: MessageHandler("call.execute",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// chan.attach handler used for detaching data nodes by message
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler(int prio = 100)
|
||||
: MessageHandler("chan.attach",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// chan.record handler used for detaching data nodes by message
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler(int prio = 100)
|
||||
: MessageHandler("chan.record",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
// Utility function to get a pointer to a call endpoint (or its peer) by id
|
||||
static CallEndpoint* locateChan(const String& id, bool peer = false)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace { // anonymous
|
|||
#define BLOCK_STACK 10
|
||||
|
||||
static Configuration s_cfg;
|
||||
static const char* s_trackName = 0;
|
||||
static bool s_extended;
|
||||
static bool s_insensitive;
|
||||
static bool s_prerouteall;
|
||||
|
@ -48,7 +49,8 @@ class RouteHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
RouteHandler(int prio)
|
||||
: MessageHandler("call.route",prio) { }
|
||||
: MessageHandler("call.route",prio,s_trackName)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -735,7 +737,8 @@ class PrerouteHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
PrerouteHandler(int prio)
|
||||
: MessageHandler("call.preroute",prio) { }
|
||||
: MessageHandler("call.preroute",prio,s_trackName)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -842,6 +845,8 @@ void RegexRoutePlugin::initialize()
|
|||
initVars(s_cfg.getSection("$once"));
|
||||
}
|
||||
initVars(s_cfg.getSection("$init"));
|
||||
s_trackName = s_cfg.getBoolValue("priorities","trackparam",false) ?
|
||||
name().c_str() : (const char*)0;
|
||||
s_extended = s_cfg.getBoolValue("priorities","extended",false);
|
||||
s_insensitive = s_cfg.getBoolValue("priorities","insensitive",false);
|
||||
s_prerouteall = s_cfg.getBoolValue("priorities","prerouteall",false);
|
||||
|
|
|
@ -27,57 +27,6 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
static Mutex s_mutex(false,"AccFile");
|
||||
static Configuration s_cfg(Engine::configFile("accfile"));
|
||||
|
||||
static char s_helpOpt[] = " accounts [reload|{login|logout|...} [account]]\r\n";
|
||||
static char s_helpMsg[] = "Controls client accounts (to other servers) operations\r\n";
|
||||
|
||||
class AccHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AccHandler()
|
||||
: MessageHandler("user.account")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class CmdHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CmdHandler()
|
||||
: MessageHandler("engine.command")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class HelpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
HelpHandler()
|
||||
: MessageHandler("engine.help")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StartHandler()
|
||||
: MessageHandler("engine.start",150)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AccFilePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
|
@ -88,6 +37,61 @@ private:
|
|||
bool m_first;
|
||||
};
|
||||
|
||||
static Mutex s_mutex(false,"AccFile");
|
||||
static Configuration s_cfg(Engine::configFile("accfile"));
|
||||
|
||||
static char s_helpOpt[] = " accounts [reload|{login|logout|...} [account]]\r\n";
|
||||
static char s_helpMsg[] = "Controls client accounts (to other servers) operations\r\n";
|
||||
|
||||
INIT_PLUGIN(AccFilePlugin);
|
||||
|
||||
|
||||
class AccHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AccHandler()
|
||||
: MessageHandler("user.account",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class CmdHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CmdHandler()
|
||||
: MessageHandler("engine.command",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class HelpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
HelpHandler()
|
||||
: MessageHandler("engine.help",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class StartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StartHandler()
|
||||
: MessageHandler("engine.start",150,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
static void copyParams(NamedList& dest, const NamedList& src)
|
||||
{
|
||||
for (unsigned int i=0;i<src.length();i++) {
|
||||
|
@ -269,8 +273,6 @@ void AccFilePlugin::initialize()
|
|||
}
|
||||
}
|
||||
|
||||
INIT_PLUGIN(AccFilePlugin);
|
||||
|
||||
}; // anonymous namespace
|
||||
|
||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||
|
|
|
@ -468,26 +468,6 @@ private:
|
|||
String m_groupName; // Group's name (saved to be printed in destructor)
|
||||
};
|
||||
|
||||
// engine.start handler (start detectors on lines expectind data before ring)
|
||||
class EngineStartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineStartHandler()
|
||||
: MessageHandler("engine.start",100)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// chan.notify handler (notify lines on detector events)
|
||||
class ChanNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanNotifyHandler()
|
||||
: MessageHandler("chan.notify",100)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Module data and functions
|
||||
|
@ -503,6 +483,27 @@ static const char* s_groupStatusDetail = "format=Type|Lines";
|
|||
static const char* s_recStatusDetail = "format=Status|Address|Peer";
|
||||
|
||||
|
||||
// engine.start handler (start detectors on lines expectind data before ring)
|
||||
class EngineStartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineStartHandler()
|
||||
: MessageHandler("engine.start",100,plugin.name())
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// chan.notify handler (notify lines on detector events)
|
||||
class ChanNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanNotifyHandler()
|
||||
: MessageHandler("chan.notify",100,plugin.name())
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
// Decode a line address into group name and circuit code
|
||||
// Set first to decode group name until first '/'
|
||||
// Return:
|
||||
|
|
|
@ -112,16 +112,6 @@ private:
|
|||
String m_prefix; // Module's prefix
|
||||
};
|
||||
|
||||
// chan.attach handler
|
||||
class ChanAttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanAttachHandler()
|
||||
: MessageHandler("chan.attach",100)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Module's data
|
||||
*/
|
||||
|
@ -130,6 +120,17 @@ static ObjList s_consumers; // Consumers list
|
|||
static unsigned int s_count = 0; // The number of active consumers
|
||||
|
||||
|
||||
// chan.attach handler
|
||||
class ChanAttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanAttachHandler()
|
||||
: MessageHandler("chan.attach",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ADConsumer
|
||||
*/
|
||||
|
|
|
@ -220,18 +220,6 @@ private:
|
|||
ObjList* m_items;
|
||||
};
|
||||
|
||||
class EngineHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineHandler(bool start)
|
||||
: MessageHandler(start ? "engine.start" : "engine.stop"),
|
||||
m_start(start)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
protected:
|
||||
bool m_start;
|
||||
};
|
||||
|
||||
class CacheModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -328,6 +316,20 @@ static const String s_cmdHelp[CmdCount] = {
|
|||
"Flush (clear) a cache's memory. Use 'id' (can be repeated) parameter to delete specific item(s) only"
|
||||
};
|
||||
|
||||
|
||||
class EngineHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineHandler(bool start)
|
||||
: MessageHandler(start ? "engine.start" : "engine.stop",100,__plugin.name()),
|
||||
m_start(start)
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
protected:
|
||||
bool m_start;
|
||||
};
|
||||
|
||||
|
||||
// Check if application or current thread are terminating
|
||||
static inline bool exiting()
|
||||
{
|
||||
|
|
|
@ -45,36 +45,6 @@ private:
|
|||
int m_count;
|
||||
};
|
||||
|
||||
class CdrHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CdrHandler(int prio)
|
||||
: MessageHandler("call.cdr",prio) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RouteHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RouteHandler(int prio)
|
||||
: MessageHandler("call.route",prio) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler() : MessageHandler("engine.status") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class CommandHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CommandHandler() : MessageHandler("engine.command") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class CallCountersPlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
|
@ -95,6 +65,43 @@ static Mutex s_mutex(false,"CallCounters");
|
|||
INIT_PLUGIN(CallCountersPlugin);
|
||||
|
||||
|
||||
class CdrHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CdrHandler(int prio)
|
||||
: MessageHandler("call.cdr",prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RouteHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RouteHandler(int prio)
|
||||
: MessageHandler("call.route",prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class StatusHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StatusHandler()
|
||||
: MessageHandler("engine.status",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class CommandHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
CommandHandler()
|
||||
: MessageHandler("engine.command",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
bool Context::remove(const String& id)
|
||||
{
|
||||
String* s = static_cast<String*>(m_calls.remove(id,false));
|
||||
|
|
|
@ -27,14 +27,6 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
class CpuNotify : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline CpuNotify()
|
||||
: MessageHandler("monitor.notify") {}
|
||||
virtual bool received(Message& m);
|
||||
};
|
||||
|
||||
class Monitor : public String
|
||||
{
|
||||
public:
|
||||
|
@ -75,6 +67,17 @@ static CongestionModule s_module;
|
|||
static const String s_target = "engine";
|
||||
static const char* s_mutexName = "CCongestion";
|
||||
|
||||
|
||||
class CpuNotify : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline CpuNotify()
|
||||
: MessageHandler("monitor.notify",100,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message& m);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* class CpuNotify
|
||||
*/
|
||||
|
|
|
@ -186,18 +186,6 @@ private:
|
|||
CpuMonitor m_system;
|
||||
};
|
||||
|
||||
class QueryHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline QueryHandler(unsigned int priority = 100)
|
||||
: MessageHandler("monitor.query",priority)
|
||||
{ }
|
||||
virtual ~QueryHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
class CpuModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -218,6 +206,17 @@ static int s_defaultHysteresis = 2;
|
|||
static int s_bufLen = 4096;
|
||||
static int s_smooth = 33;
|
||||
|
||||
class QueryHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline QueryHandler(unsigned int priority = 100)
|
||||
: MessageHandler("monitor.query",priority,s_module.name())
|
||||
{ }
|
||||
virtual ~QueryHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
static TokenDict s_monitors[] = {
|
||||
{"userLoad", CpuUpdater::YateUser},
|
||||
{"kernelLoad", CpuUpdater::YateKernel},
|
||||
|
|
|
@ -27,27 +27,6 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach",90) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler() : MessageHandler("chan.record",90) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class ExecuteHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ExecuteHandler() : MessageHandler("call.execute",90) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class DbWriter : public MemoryStream, public GenObject
|
||||
{
|
||||
public:
|
||||
|
@ -72,6 +51,27 @@ private:
|
|||
|
||||
INIT_PLUGIN(DbWave);
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach",90,__plugin.name()) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler() : MessageHandler("chan.record",90,__plugin.name()) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class ExecuteHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
ExecuteHandler() : MessageHandler("call.execute",90,__plugin.name()) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
static void alterSource(Message& msg, const String& name)
|
||||
{
|
||||
|
|
|
@ -33,19 +33,7 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
class EventLogsHandler : public MessageHandler, public Mutex
|
||||
{
|
||||
public:
|
||||
EventLogsHandler(const char *name)
|
||||
: MessageHandler(name), Mutex(false,"EventLogs"),
|
||||
m_mappings("")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
void init(const NamedList* mappings);
|
||||
private:
|
||||
bool writeLog(const char* name, const String& line);
|
||||
NamedList m_mappings;
|
||||
};
|
||||
class EventLogsHandler;
|
||||
|
||||
class EventLogsPlugin : public Plugin
|
||||
{
|
||||
|
@ -70,6 +58,22 @@ static bool s_pubRead = false;
|
|||
INIT_PLUGIN(EventLogsPlugin);
|
||||
|
||||
|
||||
class EventLogsHandler : public MessageHandler, public Mutex
|
||||
{
|
||||
public:
|
||||
EventLogsHandler(const char *name)
|
||||
: MessageHandler(name,100,__plugin.name()),
|
||||
Mutex(false,"EventLogs"),
|
||||
m_mappings("")
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
void init(const NamedList* mappings);
|
||||
private:
|
||||
bool writeLog(const char* name, const String& line);
|
||||
NamedList m_mappings;
|
||||
};
|
||||
|
||||
|
||||
bool EventLogsHandler::writeLog(const char* name, const String& line)
|
||||
{
|
||||
File f;
|
||||
|
|
|
@ -98,24 +98,6 @@ static u_int32_t crc(const char* buf, unsigned int len)
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
class TimerHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
TimerHandler(unsigned int prio)
|
||||
: MessageHandler("engine.timer",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class HaltHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
HaltHandler(unsigned int prio)
|
||||
: MessageHandler("engine.halt",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class HBeatPlugin : public Plugin, public Mutex
|
||||
{
|
||||
public:
|
||||
|
@ -142,6 +124,25 @@ private:
|
|||
static HBeatPlugin splugin;
|
||||
|
||||
|
||||
class TimerHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
TimerHandler(unsigned int prio)
|
||||
: MessageHandler("engine.timer",prio,splugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class HaltHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
HaltHandler(unsigned int prio)
|
||||
: MessageHandler("engine.halt",prio,splugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
void HBeatPlugin::sendHeartbeat(const Time& tStamp, bool goDown)
|
||||
{
|
||||
lock();
|
||||
|
|
|
@ -66,7 +66,7 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
|
||||
|
||||
LateHandler::LateHandler(const char* name, unsigned priority)
|
||||
: MessageHandler(name,priority)
|
||||
: MessageHandler(name,priority,__plugin.name())
|
||||
{
|
||||
// build a proper routing message name
|
||||
int sep = find('.');
|
||||
|
|
|
@ -62,13 +62,6 @@ private:
|
|||
sctp_assoc_t m_assocId;
|
||||
};
|
||||
|
||||
class LKHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
LKHandler() : MessageHandler("socket.sctp") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class LKModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -85,6 +78,17 @@ unsigned int s_count = 0;
|
|||
const char* s_mutexName = "LKSctpCounter";
|
||||
Mutex s_countMutex(true,s_mutexName);
|
||||
|
||||
|
||||
class LKHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
LKHandler()
|
||||
: MessageHandler("socket.sctp",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* class LKSocket
|
||||
*/
|
||||
|
|
|
@ -277,27 +277,6 @@ private:
|
|||
RefPointer<MGCPMessage> m_msg;
|
||||
};
|
||||
|
||||
class RtpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RtpHandler(unsigned int prio) : MessageHandler("chan.rtp",prio) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class SdpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
SdpHandler(unsigned int prio) : MessageHandler("chan.sdp",prio) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DTMFHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DTMFHandler() : MessageHandler("chan.dtmf",150) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class MGCPPlugin : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -345,6 +324,35 @@ static const TokenDict s_dict_rqnt[] = {
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
class RtpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RtpHandler(unsigned int prio)
|
||||
: MessageHandler("chan.rtp",prio,splugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class SdpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
SdpHandler(unsigned int prio)
|
||||
: MessageHandler("chan.sdp",prio,splugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DTMFHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DTMFHandler()
|
||||
: MessageHandler("chan.dtmf",150,splugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
// Copy one parameter (if present) with new name
|
||||
static bool copyRename(NamedList& dest, const char* dname, const NamedList& src, const String& sname)
|
||||
{
|
||||
|
|
|
@ -62,108 +62,6 @@ typedef struct {
|
|||
u_int64_t resetTime;
|
||||
} SIPInfo;
|
||||
|
||||
/**
|
||||
* Class MsgUpdateHandler
|
||||
* Class for handling a "module.update" message
|
||||
*/
|
||||
class MsgUpdateHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline MsgUpdateHandler(unsigned int priority = 100)
|
||||
: MessageHandler("module.update",priority)
|
||||
{ }
|
||||
virtual ~MsgUpdateHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class SnmpMsgHandler
|
||||
* Class for handling a "monitor.query" message, message used for obtaining information from the monitor
|
||||
*/
|
||||
class SnmpMsgHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline SnmpMsgHandler(unsigned int priority = 100)
|
||||
: MessageHandler("monitor.query",priority)
|
||||
{ }
|
||||
virtual ~SnmpMsgHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class HangupHandler
|
||||
* Handler for "chan.hangup" message"
|
||||
*/
|
||||
class HangupHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline HangupHandler(unsigned int priority = 100)
|
||||
: MessageHandler("chan.hangup",priority)
|
||||
{ }
|
||||
virtual ~HangupHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class EngineStartHandler
|
||||
* Handler for "engine.start" message
|
||||
*/
|
||||
class EngineStartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineStartHandler(unsigned int priority = 100)
|
||||
: MessageHandler("engine.start",priority)
|
||||
{ }
|
||||
virtual ~EngineStartHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class AuthHandler
|
||||
* Handler for a "user.auth" message. It counts the number of authentication requests
|
||||
*/
|
||||
class AuthHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline AuthHandler()
|
||||
: MessageHandler("user.auth",0),
|
||||
m_count(0)
|
||||
{ }
|
||||
virtual ~AuthHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
// return the number of authentication requests
|
||||
inline unsigned int getCount()
|
||||
{ return m_count; }
|
||||
private:
|
||||
unsigned int m_count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class RegisterHandler
|
||||
* Handler for a "user.register" message. It counts the number of register requests
|
||||
*/
|
||||
class RegisterHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline RegisterHandler()
|
||||
: MessageHandler("user.register",0),
|
||||
m_count(0)
|
||||
{ }
|
||||
virtual ~RegisterHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
// return the count
|
||||
inline unsigned int getCount()
|
||||
{ return m_count; }
|
||||
private:
|
||||
unsigned int m_count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class Cache
|
||||
* BaseClass for retaining and expiring different type of data
|
||||
|
@ -893,6 +791,11 @@ private:
|
|||
Mutex m_cfgMtx;
|
||||
};
|
||||
|
||||
class SnmpMsgHandler;
|
||||
class EngineStartHandler;
|
||||
class AuthHandler;
|
||||
class RegisterHandler;
|
||||
|
||||
/**
|
||||
* Class Monitor
|
||||
* Monitoring module
|
||||
|
@ -1557,6 +1460,110 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class MsgUpdateHandler
|
||||
* Class for handling a "module.update" message
|
||||
*/
|
||||
class MsgUpdateHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline MsgUpdateHandler(unsigned int priority = 100)
|
||||
: MessageHandler("module.update",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~MsgUpdateHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class SnmpMsgHandler
|
||||
* Class for handling a "monitor.query" message, message used for obtaining information from the monitor
|
||||
*/
|
||||
class SnmpMsgHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline SnmpMsgHandler(unsigned int priority = 100)
|
||||
: MessageHandler("monitor.query",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~SnmpMsgHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class HangupHandler
|
||||
* Handler for "chan.hangup" message"
|
||||
*/
|
||||
class HangupHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline HangupHandler(unsigned int priority = 100)
|
||||
: MessageHandler("chan.hangup",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~HangupHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class EngineStartHandler
|
||||
* Handler for "engine.start" message
|
||||
*/
|
||||
class EngineStartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineStartHandler(unsigned int priority = 100)
|
||||
: MessageHandler("engine.start",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~EngineStartHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class AuthHandler
|
||||
* Handler for a "user.auth" message. It counts the number of authentication requests
|
||||
*/
|
||||
class AuthHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline AuthHandler()
|
||||
: MessageHandler("user.auth",0,__plugin.name()),
|
||||
m_count(0)
|
||||
{ }
|
||||
virtual ~AuthHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
// return the number of authentication requests
|
||||
inline unsigned int getCount()
|
||||
{ return m_count; }
|
||||
private:
|
||||
unsigned int m_count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class RegisterHandler
|
||||
* Handler for a "user.register" message. It counts the number of register requests
|
||||
*/
|
||||
class RegisterHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline RegisterHandler()
|
||||
: MessageHandler("user.register",0,__plugin.name()),
|
||||
m_count(0)
|
||||
{ }
|
||||
virtual ~RegisterHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
// return the count
|
||||
inline unsigned int getCount()
|
||||
{ return m_count; }
|
||||
private:
|
||||
unsigned int m_count;
|
||||
};
|
||||
|
||||
|
||||
// helper function to get rid of new line characters
|
||||
static void cutNewLine(String& line) {
|
||||
if (line.endsWith("\n"))
|
||||
|
|
|
@ -60,27 +60,6 @@ private:
|
|||
String m_target;
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler() : MessageHandler("chan.record") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class MrcpRtpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MrcpRtpHandler() : MessageHandler("chan.rtp",150) { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class MrcpModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -100,6 +79,35 @@ static int s_total = 0;
|
|||
|
||||
static MrcpModule plugin;
|
||||
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler()
|
||||
: MessageHandler("chan.record",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class MrcpRtpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MrcpRtpHandler()
|
||||
: MessageHandler("chan.rtp",150,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
MrcpConsumer::MrcpConsumer(const String& id, const char* target, const char* format)
|
||||
: DataConsumer(format),
|
||||
m_source(0), m_chan(0), m_id(id)
|
||||
|
|
|
@ -178,19 +178,6 @@ private:
|
|||
MyConn* m_conn;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class MyHandler
|
||||
* Message handler for "database" message
|
||||
*/
|
||||
class MyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MyHandler(unsigned int prio = 100)
|
||||
: MessageHandler("database",prio)
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Class InitThread
|
||||
* Running thread for initializing MySQL connections
|
||||
|
@ -268,6 +255,21 @@ static MyModule module;
|
|||
static Mutex s_libMutex(false,"MySQL::lib");
|
||||
static int s_libCounter = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Class MyHandler
|
||||
* Message handler for "database" message
|
||||
*/
|
||||
class MyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
MyHandler(unsigned int prio = 100)
|
||||
: MessageHandler("database",prio,module.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* MyConn
|
||||
*/
|
||||
|
|
|
@ -58,11 +58,20 @@ private:
|
|||
bool m_initialized; // True if already initialized
|
||||
};
|
||||
|
||||
static ParkModule s_module;
|
||||
static const char* s_prefix = "park/";
|
||||
static unsigned int s_id = 1; // Channel id to use
|
||||
static ObjList s_chans; // Channel list
|
||||
static Mutex s_mutex(true,"Park"); // Global mutex
|
||||
|
||||
|
||||
// call.execute handler. Park a call
|
||||
class ParkHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ParkHandler(int prio = 100) : MessageHandler("call.execute",prio) {}
|
||||
inline ParkHandler(int prio = 100)
|
||||
: MessageHandler("call.execute",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
@ -70,7 +79,9 @@ public:
|
|||
class HaltHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline HaltHandler(int prio = 100) : MessageHandler("engine.halt",prio) {}
|
||||
inline HaltHandler(int prio = 100)
|
||||
: MessageHandler("engine.halt",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
@ -78,18 +89,13 @@ public:
|
|||
class LocateHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline LocateHandler(int prio = 100) : MessageHandler("chan.locate",prio) {}
|
||||
inline LocateHandler(int prio = 100)
|
||||
: MessageHandler("chan.locate",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
static ParkModule s_module;
|
||||
static const char* s_prefix = "park/";
|
||||
static unsigned int s_id = 1; // Channel id to use
|
||||
static ObjList s_chans; // Channel list
|
||||
static Mutex s_mutex(true,"Park"); // Global mutex
|
||||
|
||||
|
||||
// Find a parking by id
|
||||
ParkEndpoint* findParking(const String& id)
|
||||
{
|
||||
|
|
|
@ -222,8 +222,8 @@ void PBXList::init(int priority)
|
|||
priority = s_cfg.getIntValue("general","priority",priority);
|
||||
ChanAssistList::init(priority);
|
||||
installRelay(Tone,priority);
|
||||
Engine::install(new MessageRelay("chan.operation",this,Operation,priority));
|
||||
Engine::install(new MessageRelay("chan.replaced",this,Replaced,priority));
|
||||
Engine::install(new MessageRelay("chan.operation",this,Operation,priority,name()));
|
||||
Engine::install(new MessageRelay("chan.replaced",this,Replaced,priority,name()));
|
||||
}
|
||||
|
||||
void PBXList::initialize()
|
||||
|
|
|
@ -79,15 +79,6 @@ private:
|
|||
bool m_hasConn;
|
||||
};
|
||||
|
||||
class PgHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
PgHandler(unsigned int prio = 100)
|
||||
: MessageHandler("database",prio)
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class PgModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -105,6 +96,17 @@ private:
|
|||
|
||||
static PgModule module;
|
||||
|
||||
|
||||
class PgHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
PgHandler(unsigned int prio = 100)
|
||||
: MessageHandler("database",prio,module.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
PgConn::PgConn(const NamedList* sect)
|
||||
: Mutex(true,"PgConn"),
|
||||
m_name(*sect), m_conn(0),
|
||||
|
|
|
@ -46,34 +46,6 @@ class EngineStartHandler;
|
|||
class PresenceModule;
|
||||
class ExpirePresence;
|
||||
|
||||
/*
|
||||
* Class ResNotifyHandler
|
||||
* Handles a resource.notify message
|
||||
*/
|
||||
class ResNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ResNotifyHandler(unsigned int priority = 10)
|
||||
: MessageHandler("resource.notify", priority)
|
||||
{ }
|
||||
virtual ~ResNotifyHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/*
|
||||
* Class EngineStartHandler
|
||||
* Handles a engine.start message
|
||||
*/
|
||||
class EngineStartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineStartHandler()
|
||||
: MessageHandler("engine.start",100)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/*
|
||||
* class Presence
|
||||
* A presence object
|
||||
|
@ -155,6 +127,9 @@ public:
|
|||
ObjList* find(const String& contact, const String& instance);
|
||||
};
|
||||
|
||||
class ResNotifyhandler;
|
||||
class EngineStarthandler;
|
||||
|
||||
/*
|
||||
* Class PresenceModule
|
||||
* Module for handling presences
|
||||
|
@ -257,8 +232,8 @@ private:
|
|||
static String s_msgPrefix = "presence";
|
||||
static unsigned int s_presExpire = 0; // Presence expire interval (relese memory only)
|
||||
unsigned int ExpirePresence::s_expireTime = 0;
|
||||
INIT_PLUGIN(PresenceModule);
|
||||
|
||||
INIT_PLUGIN(PresenceModule);
|
||||
|
||||
UNLOAD_PLUGIN(unloadNow)
|
||||
{
|
||||
|
@ -267,6 +242,35 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class ResNotifyHandler
|
||||
* Handles a resource.notify message
|
||||
*/
|
||||
class ResNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ResNotifyHandler(unsigned int priority = 10)
|
||||
: MessageHandler("resource.notify",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~ResNotifyHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/*
|
||||
* Class EngineStartHandler
|
||||
* Handles a engine.start message
|
||||
*/
|
||||
class EngineStartHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline EngineStartHandler()
|
||||
: MessageHandler("engine.start",100,__plugin.name())
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
/*
|
||||
* ResNotifyHandler
|
||||
*/
|
||||
|
|
|
@ -108,26 +108,6 @@ private:
|
|||
// if the call was already terminated
|
||||
};
|
||||
|
||||
// chan.notify handler used to catch queued calls
|
||||
class ChanNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanNotifyHandler(int prio = 10)
|
||||
: MessageHandler("chan.notify",prio)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// call.cdr handler used to signal queued calls termination
|
||||
class CallCdrHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline CallCdrHandler(int prio = 10)
|
||||
: MessageHandler("call.cdr",prio)
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// Thread processing a call from queue
|
||||
class QueuedCallWorker : public Thread
|
||||
{
|
||||
|
@ -137,6 +117,9 @@ public:
|
|||
virtual void run();
|
||||
};
|
||||
|
||||
class ChanNotifyHandler;
|
||||
class CallCdrHandler;
|
||||
|
||||
// The module
|
||||
class QueuesNotifyModule : public Module
|
||||
{
|
||||
|
@ -207,6 +190,27 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
}
|
||||
|
||||
|
||||
// chan.notify handler used to catch queued calls
|
||||
class ChanNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline ChanNotifyHandler(int prio = 10)
|
||||
: MessageHandler("chan.notify",prio,__plugin.name())
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// call.cdr handler used to signal queued calls termination
|
||||
class CallCdrHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline CallCdrHandler(int prio = 10)
|
||||
: MessageHandler("call.cdr",prio,__plugin.name())
|
||||
{}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* QueuedCall
|
||||
*/
|
||||
|
|
|
@ -27,12 +27,34 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
class RegfilePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
RegfilePlugin();
|
||||
~RegfilePlugin();
|
||||
virtual void initialize();
|
||||
void populate(bool first);
|
||||
private:
|
||||
bool m_init;
|
||||
};
|
||||
|
||||
Mutex s_mutex(false,"RegFile");
|
||||
static Configuration s_cfg(Engine::configFile("regfile"));
|
||||
static Configuration s_accounts;
|
||||
static bool s_create = false;
|
||||
static const String s_general = "general";
|
||||
static ObjList s_expand;
|
||||
static int s_count = 0;
|
||||
|
||||
INIT_PLUGIN(RegfilePlugin);
|
||||
|
||||
|
||||
class AuthHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AuthHandler(const char *name, unsigned prio = 100)
|
||||
: MessageHandler(name,prio) { }
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -40,7 +62,8 @@ class RegistHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
RegistHandler(const char *name, unsigned prio = 100)
|
||||
: MessageHandler(name,prio) { }
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -48,7 +71,8 @@ class UnRegistHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
UnRegistHandler(const char *name, unsigned prio = 100)
|
||||
: MessageHandler(name,prio) { }
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -66,7 +90,8 @@ class StatusHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
StatusHandler(const char *name, unsigned prio = 100)
|
||||
: MessageHandler(name,prio) { }
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -74,7 +99,8 @@ class CommandHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
CommandHandler(const char *name, unsigned prio = 100)
|
||||
: MessageHandler(name,prio) { }
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -82,7 +108,8 @@ class ExpireHandler : public MessageHandler
|
|||
{
|
||||
public:
|
||||
ExpireHandler()
|
||||
: MessageHandler("engine.timer",100) { }
|
||||
: MessageHandler("engine.timer",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
@ -97,28 +124,6 @@ private:
|
|||
String m_username;
|
||||
};
|
||||
|
||||
class RegfilePlugin : public Plugin
|
||||
{
|
||||
public:
|
||||
RegfilePlugin();
|
||||
~RegfilePlugin();
|
||||
virtual void initialize();
|
||||
void populate(bool first);
|
||||
private:
|
||||
bool m_init;
|
||||
};
|
||||
|
||||
|
||||
Mutex s_mutex(false,"RegFile");
|
||||
|
||||
static Configuration s_cfg(Engine::configFile("regfile"));
|
||||
static Configuration s_accounts;
|
||||
static bool s_create = false;
|
||||
static const String s_general = "general";
|
||||
static ObjList s_expand;
|
||||
static int s_count = 0;
|
||||
|
||||
INIT_PLUGIN(RegfilePlugin);
|
||||
|
||||
static void clearListParams(NamedList& list, const char* name)
|
||||
{
|
||||
|
@ -247,7 +252,7 @@ bool UnRegistHandler::received(Message &msg)
|
|||
}
|
||||
|
||||
RouteHandler::RouteHandler(const char *name, unsigned prio)
|
||||
: MessageHandler(name,prio)
|
||||
: MessageHandler(name,prio,__plugin.name())
|
||||
{
|
||||
m_skip = String("alternatives,password").split(',');
|
||||
}
|
||||
|
|
|
@ -180,9 +180,9 @@ protected:
|
|||
virtual bool received(Message& msg, int id);
|
||||
private:
|
||||
static int getPriority(const String& name);
|
||||
static void addHandler(const char *name, int type);
|
||||
static void addHandler(AAAHandler* handler);
|
||||
static void addHandler(FallBackHandler* handler);
|
||||
void addHandler(const char *name, int type);
|
||||
void addHandler(AAAHandler* handler);
|
||||
void addHandler(FallBackHandler* handler);
|
||||
bool m_init;
|
||||
AccountsModule *m_accountsmodule;
|
||||
};
|
||||
|
@ -956,6 +956,10 @@ int RegistModule::getPriority(const String& name)
|
|||
|
||||
void RegistModule::addHandler(AAAHandler* handler)
|
||||
{
|
||||
String trackName(name());
|
||||
if (trackName && handler->priority())
|
||||
trackName << ":" << handler->priority();
|
||||
handler->trackName(trackName);
|
||||
handler->loadAccount();
|
||||
s_handlers.append(handler);
|
||||
handler->loadQuery();
|
||||
|
@ -965,6 +969,10 @@ void RegistModule::addHandler(AAAHandler* handler)
|
|||
|
||||
void RegistModule::addHandler(FallBackHandler* handler)
|
||||
{
|
||||
String trackName(name());
|
||||
if (trackName && handler->priority())
|
||||
trackName << ":" << handler->priority();
|
||||
handler->trackName(trackName);
|
||||
s_handlers.append(handler);
|
||||
Engine::install(handler);
|
||||
}
|
||||
|
@ -1162,8 +1170,8 @@ bool AccountsModule::received(Message &msg, int id)
|
|||
void AccountsModule::initialize()
|
||||
{
|
||||
if (s_cfg.getBoolValue("general","accounts")) {
|
||||
Engine::install(new MessageRelay("user.notify",this,Notify,100));
|
||||
Engine::install(new MessageRelay("engine.timer",this,Timer,100));
|
||||
Engine::install(new MessageRelay("user.notify",this,Notify,100,module.name()));
|
||||
Engine::install(new MessageRelay("engine.timer",this,Timer,100,module.name()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,33 +30,6 @@
|
|||
using namespace TelEngine;
|
||||
namespace { // anonymous
|
||||
|
||||
// sip.subscribe handler
|
||||
class YSipSubscribeHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
YSipSubscribeHandler(int prio = 100)
|
||||
: MessageHandler("sip.subscribe",prio)
|
||||
{}
|
||||
virtual bool received(Message &msg);
|
||||
// Get the event from a received message. Set the content type
|
||||
// Set 'code' parameter of the message if false is returned
|
||||
bool getEventData(Message& msg, int& event, String& evName, String& content);
|
||||
};
|
||||
|
||||
// resource.notify handler
|
||||
class YSipNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
YSipNotifyHandler(int prio = 100)
|
||||
: MessageHandler("resource.notify",prio)
|
||||
{}
|
||||
virtual bool received(Message &msg);
|
||||
// Create the body for 'dialog' event notification
|
||||
void createDialogBody(String& dest, const Message& src, const String& entity);
|
||||
// Create the body for 'message-summary' event notification
|
||||
void createMWIBody(String& dest, const Message& src);
|
||||
};
|
||||
|
||||
// Features module
|
||||
class YSipFeatures : public Module
|
||||
{
|
||||
|
@ -115,6 +88,34 @@ static TokenDict s_contents[] = {
|
|||
};
|
||||
|
||||
|
||||
// sip.subscribe handler
|
||||
class YSipSubscribeHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
YSipSubscribeHandler(int prio = 100)
|
||||
: MessageHandler("sip.subscribe",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
// Get the event from a received message. Set the content type
|
||||
// Set 'code' parameter of the message if false is returned
|
||||
bool getEventData(Message& msg, int& event, String& evName, String& content);
|
||||
};
|
||||
|
||||
// resource.notify handler
|
||||
class YSipNotifyHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
YSipNotifyHandler(int prio = 100)
|
||||
: MessageHandler("resource.notify",prio,s_module.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
// Create the body for 'dialog' event notification
|
||||
void createDialogBody(String& dest, const Message& src, const String& entity);
|
||||
// Create the body for 'message-summary' event notification
|
||||
void createMWIBody(String& dest, const Message& src);
|
||||
};
|
||||
|
||||
|
||||
// Escape a string to be packed into another
|
||||
inline void appendEsc(String& dest, const String& src1, const String& src2, const char sep = ' ')
|
||||
{
|
||||
|
|
|
@ -1545,8 +1545,8 @@ GenericUser* GenericUserList::findUser(const String& user)
|
|||
* SubMessageHandler
|
||||
*/
|
||||
SubMessageHandler::SubMessageHandler(int handler, int prio)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),prio),
|
||||
m_handler(handler)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),prio,__plugin.name()),
|
||||
m_handler(handler)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -28,25 +28,8 @@ using namespace TelEngine;
|
|||
|
||||
namespace {
|
||||
|
||||
class UsersModule;
|
||||
class UserUpdateHandler;
|
||||
|
||||
/**
|
||||
* Class UserUpdateHandler
|
||||
* Handles a user.update message
|
||||
*/
|
||||
class UserUpdateHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline UserUpdateHandler(unsigned int priority = 100)
|
||||
: MessageHandler("user.update", priority)
|
||||
{ }
|
||||
virtual ~UserUpdateHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class UsersModule
|
||||
* Module for handling users operations
|
||||
|
@ -131,6 +114,22 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class UserUpdateHandler
|
||||
* Handles a user.update message
|
||||
*/
|
||||
class UserUpdateHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline UserUpdateHandler(unsigned int priority = 100)
|
||||
: MessageHandler("user.update",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~UserUpdateHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
// Get a space separated word from a buffer. msgUnescape() it if requested
|
||||
// Return false if empty
|
||||
static bool getWord(String& buf, String& word, bool unescape = false)
|
||||
|
|
|
@ -371,24 +371,6 @@ private:
|
|||
DataBlock m_authdata;
|
||||
};
|
||||
|
||||
class AuthHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline AuthHandler(int prio)
|
||||
: MessageHandler("user.auth",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AcctHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline AcctHandler(int prio)
|
||||
: MessageHandler("call.cdr",prio)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class RadiusModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -401,6 +383,26 @@ protected:
|
|||
|
||||
INIT_PLUGIN(RadiusModule);
|
||||
|
||||
|
||||
class AuthHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline AuthHandler(int prio)
|
||||
: MessageHandler("user.auth",prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class AcctHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline AcctHandler(int prio)
|
||||
: MessageHandler("call.cdr",prio,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
// PortaOne specific routing
|
||||
static void portaBillingRoute(NamedList& params, const ObjList* attributes)
|
||||
{
|
||||
|
|
|
@ -839,14 +839,6 @@ protected:
|
|||
int m_ssn;
|
||||
};
|
||||
|
||||
class SCCPHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline SCCPHandler()
|
||||
: MessageHandler("sccp.generate",100) {}
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
static SigDriver plugin;
|
||||
static SigFactory factory;
|
||||
|
@ -937,6 +929,17 @@ const TokenDict SigFactory::s_compClass[] = {
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
class SCCPHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline SCCPHandler()
|
||||
: MessageHandler("sccp.generate",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
// Construct a locally configured component
|
||||
SignallingComponent* SigFactory::create(const String& type, const NamedList& name)
|
||||
{
|
||||
|
@ -4733,7 +4736,7 @@ void SigTrunkThread::run()
|
|||
*/
|
||||
// Init the ISUP component
|
||||
IsupDecodeHandler::IsupDecodeHandler(bool decode)
|
||||
: MessageHandler(decode ? "isup.decode" : "isup.encode",100)
|
||||
: MessageHandler(decode ? "isup.decode" : "isup.encode",100,plugin.name())
|
||||
{
|
||||
NamedList params("");
|
||||
String dname = plugin.prefix() + *this;
|
||||
|
|
|
@ -519,20 +519,6 @@ private:
|
|||
Cipher* m_cipher;
|
||||
};
|
||||
|
||||
/**
|
||||
* TrapHandler - message handler for incoming notifications
|
||||
*/
|
||||
class TrapHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline TrapHandler(unsigned int priority = 100)
|
||||
: MessageHandler("monitor.notify",priority)
|
||||
{ }
|
||||
virtual ~TrapHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
const TokenDict TransportType::s_typeText[] = {
|
||||
{"UDP", UDP},
|
||||
{"TCP", TCP},
|
||||
|
@ -621,7 +607,6 @@ static const DataBlock s_zeroKey(0,12);
|
|||
|
||||
INIT_PLUGIN(SnmpAgent);
|
||||
|
||||
|
||||
UNLOAD_PLUGIN(unloadNow)
|
||||
{
|
||||
if (unloadNow && !__plugin.unload())
|
||||
|
@ -629,6 +614,22 @@ UNLOAD_PLUGIN(unloadNow)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TrapHandler - message handler for incoming notifications
|
||||
*/
|
||||
class TrapHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
inline TrapHandler(unsigned int priority = 100)
|
||||
: MessageHandler("monitor.notify",priority,__plugin.name())
|
||||
{ }
|
||||
virtual ~TrapHandler()
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
|
||||
static DataBlock toNetworkOrder(u_int64_t val, unsigned int size)
|
||||
{
|
||||
XDebug(&__plugin,DebugAll,"toNetworkOrder("FMT64")",val);
|
||||
|
|
|
@ -131,20 +131,6 @@ private:
|
|||
Tone2PoleFilter m_dtmfH[4];
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler() : MessageHandler("chan.record") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class ToneDetectorModule : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -161,6 +147,24 @@ static int s_count = 0;
|
|||
|
||||
static ToneDetectorModule plugin;
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler()
|
||||
: MessageHandler("chan.record",100,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
// generated CNG detector (1100Hz) - either of the 2 below:
|
||||
// mkfilter -Bp -Re 50 -a 0.137500
|
||||
// -> 2-pole resonator bandpass, 1100Hz, Q-factor=50
|
||||
|
|
|
@ -173,12 +173,7 @@ public:
|
|||
bool attachConsumer(const char* consumer);
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
class AttachHandler;
|
||||
|
||||
class ToneGenDriver : public Driver
|
||||
{
|
||||
|
@ -195,6 +190,16 @@ private:
|
|||
};
|
||||
|
||||
INIT_PLUGIN(ToneGenDriver);
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message& msg);
|
||||
};
|
||||
|
||||
static ObjList s_toneDesc; // List of configured tones
|
||||
static ObjList s_defToneDesc; // List of default tones
|
||||
static String s_defLang; // Default tone language
|
||||
|
|
|
@ -113,19 +113,7 @@ private:
|
|||
bool m_disc;
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler() : MessageHandler("chan.record") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
class AttachHandler;
|
||||
|
||||
class WaveFileDriver : public Driver
|
||||
{
|
||||
|
@ -148,6 +136,25 @@ bool s_pubReadable = false;
|
|||
INIT_PLUGIN(WaveFileDriver);
|
||||
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler()
|
||||
: MessageHandler("chan.attach",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class RecordHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RecordHandler()
|
||||
: MessageHandler("chan.record",100,__plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t sign;
|
||||
uint32_t offs;
|
||||
|
|
|
@ -357,18 +357,6 @@ private:
|
|||
bool m_threadsCreated; // True if reading and get events threads were created
|
||||
};
|
||||
|
||||
/*
|
||||
* YIAXRegDataHandler
|
||||
*/
|
||||
class YIAXRegDataHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
YIAXRegDataHandler()
|
||||
: MessageHandler("user.login",150)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
/*
|
||||
* YIAXDriver
|
||||
*/
|
||||
|
@ -411,6 +399,23 @@ protected:
|
|||
int m_port;
|
||||
};
|
||||
|
||||
static YIAXLineContainer s_lines; // Lines
|
||||
static Thread::Priority s_priority = Thread::Normal; // Threads priority
|
||||
static bool s_callTokenOut = true; // Send an empty call token on outgoing calls
|
||||
static YIAXDriver iplugin; // Init the driver
|
||||
|
||||
/*
|
||||
* YIAXRegDataHandler
|
||||
*/
|
||||
class YIAXRegDataHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
YIAXRegDataHandler()
|
||||
: MessageHandler("user.login",150,iplugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class YIAXConnection;
|
||||
|
||||
/*
|
||||
|
@ -560,11 +565,6 @@ private:
|
|||
/*
|
||||
* Local data
|
||||
*/
|
||||
static YIAXLineContainer s_lines; // Lines
|
||||
static Thread::Priority s_priority = Thread::Normal; // Threads priority
|
||||
static bool s_callTokenOut = true; // Send an empty call token on outgoing calls
|
||||
static YIAXDriver iplugin; // Init the driver
|
||||
|
||||
static unsigned int s_expires_min = 60;
|
||||
static unsigned int s_expires_def = 60;
|
||||
static unsigned int s_expires_max = 3600;
|
||||
|
|
|
@ -3661,8 +3661,8 @@ void YJGTransfer::run()
|
|||
* JBMessageHandler
|
||||
*/
|
||||
YJGMessageHandler::YJGMessageHandler(int handler, int prio)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),prio),
|
||||
m_handler(handler)
|
||||
: MessageHandler(lookup(handler,s_msgHandler),prio,plugin.name()),
|
||||
m_handler(handler)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -348,27 +348,6 @@ private:
|
|||
Cipher* m_cipher;
|
||||
};
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class RtpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RtpHandler() : MessageHandler("chan.rtp") { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DTMFHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DTMFHandler() : MessageHandler("chan.dtmf",150) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class YRTPPlugin : public Module
|
||||
{
|
||||
public:
|
||||
|
@ -394,6 +373,28 @@ private:
|
|||
};
|
||||
|
||||
static YRTPPlugin splugin;
|
||||
|
||||
class AttachHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
AttachHandler() : MessageHandler("chan.attach",100,splugin.name()) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class RtpHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
RtpHandler() : MessageHandler("chan.rtp",100,splugin.name()) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class DTMFHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
DTMFHandler() : MessageHandler("chan.dtmf",150,splugin.name()) { }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
static ObjList s_calls;
|
||||
static ObjList s_mirrors;
|
||||
static Mutex s_mutex(false,"YRTPChan");
|
||||
|
|
|
@ -930,24 +930,6 @@ private:
|
|||
int m_code;
|
||||
};
|
||||
|
||||
class UserHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
UserHandler()
|
||||
: MessageHandler("user.login",150)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class SipHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
SipHandler()
|
||||
: MessageHandler("xsip.generate",110)
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// Proxy class used to transport a data buffer or a socket
|
||||
// The object doesn't own its data
|
||||
class RefObjectProxy : public RefObject
|
||||
|
@ -1018,6 +1000,25 @@ private:
|
|||
};
|
||||
|
||||
static SIPDriver plugin;
|
||||
|
||||
class UserHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
UserHandler()
|
||||
: MessageHandler("user.login",150,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
class SipHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
SipHandler()
|
||||
: MessageHandler("xsip.generate",110,plugin.name())
|
||||
{ }
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
static ObjList s_lines;
|
||||
static Configuration s_cfg;
|
||||
static Mutex s_globalMutex(true,"SIPGlobal"); // Protect globals (don't use the plugin to avoid deadlocks)
|
||||
|
|
|
@ -415,17 +415,6 @@ private:
|
|||
String m_security; // Random string used to build id for a binding request
|
||||
};
|
||||
|
||||
/**
|
||||
* socket.stun message handler
|
||||
*/
|
||||
class StunHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StunHandler() : MessageHandler("socket.stun") {}
|
||||
// Process message. Create and install filter.
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* YStunPlugin
|
||||
*/
|
||||
|
@ -476,6 +465,19 @@ TokenDict YStunAttribute::s_tokens[] = {
|
|||
{0,0}
|
||||
};
|
||||
|
||||
/**
|
||||
* socket.stun message handler
|
||||
*/
|
||||
class StunHandler : public MessageHandler
|
||||
{
|
||||
public:
|
||||
StunHandler()
|
||||
: MessageHandler("socket.stun",100,iplugin.name())
|
||||
{}
|
||||
// Process message. Create and install filter.
|
||||
virtual bool received(Message &msg);
|
||||
};
|
||||
|
||||
// YStunAttributeError
|
||||
void YStunAttributeError::toString(String& dest)
|
||||
{
|
||||
|
|
50
yatengine.h
50
yatengine.h
|
@ -215,6 +215,7 @@ private:
|
|||
|
||||
class MessageDispatcher;
|
||||
class MessageRelay;
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* This class holds the messages that are moved around in the engine.
|
||||
|
@ -406,8 +407,11 @@ public:
|
|||
* Creates a new message handler.
|
||||
* @param name Name of the handled message - may be NULL
|
||||
* @param priority Priority of the handler, 0 = top
|
||||
* @param trackName Name to be used in handler tracking
|
||||
* @param addPriority True to append non-zero priority to trackName
|
||||
*/
|
||||
explicit MessageHandler(const char* name, unsigned priority = 100);
|
||||
explicit MessageHandler(const char* name, unsigned priority = 100,
|
||||
const char* trackName = 0, bool addPriority = true);
|
||||
|
||||
/**
|
||||
* Handler destructor.
|
||||
|
@ -433,6 +437,21 @@ public:
|
|||
inline unsigned priority() const
|
||||
{ return m_priority; }
|
||||
|
||||
/**
|
||||
* Retrieve the tracking name of this handler
|
||||
* @return Name that is to be used in tracking operation
|
||||
*/
|
||||
inline const String& trackName() const
|
||||
{ return m_trackName; }
|
||||
|
||||
/**
|
||||
* Set a new tracking name for this handler.
|
||||
* Works only if the handler was not yet inserted into a dispatcher
|
||||
* @param name Name that is to be used in tracking operation
|
||||
*/
|
||||
inline void trackName(const char* name)
|
||||
{ if (!m_dispatcher) m_trackName = name; }
|
||||
|
||||
/**
|
||||
* Retrieve the filter (if installed) associated to this handler
|
||||
*/
|
||||
|
@ -469,6 +488,7 @@ protected:
|
|||
private:
|
||||
virtual bool receivedInternal(Message& msg);
|
||||
void safeNow();
|
||||
String m_trackName;
|
||||
unsigned m_priority;
|
||||
int m_unsafe;
|
||||
MessageDispatcher* m_dispatcher;
|
||||
|
@ -505,9 +525,14 @@ public:
|
|||
* @param receiver Receiver of th relayed messages
|
||||
* @param id Numeric identifier to pass to receiver
|
||||
* @param priority Priority of the handler, 0 = top
|
||||
* @param trackName Name to be used in handler tracking
|
||||
* @param addPriority True to append non-zero priority to trackName
|
||||
*/
|
||||
MessageRelay(const char* name, MessageReceiver* receiver, int id, int priority = 100)
|
||||
: MessageHandler(name,priority), m_receiver(receiver), m_id(id) { }
|
||||
inline MessageRelay(const char* name, MessageReceiver* receiver, int id,
|
||||
int priority = 100, const char* trackName = 0, bool addPriority = true)
|
||||
: MessageHandler(name,priority,trackName,addPriority),
|
||||
m_receiver(receiver), m_id(id)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* This method is not called from MessageHandler through polymorphism
|
||||
|
@ -571,18 +596,26 @@ class YATE_API MessagePostHook : public GenObject, public MessageNotifier
|
|||
*/
|
||||
class YATE_API MessageDispatcher : public GenObject, public Mutex
|
||||
{
|
||||
friend class Engine;
|
||||
YNOCOPY(MessageDispatcher); // no automatic copies please
|
||||
public:
|
||||
/**
|
||||
* Creates a new message dispatcher.
|
||||
* @param trackParam Name of the parameter used in tracking handlers
|
||||
*/
|
||||
MessageDispatcher();
|
||||
MessageDispatcher(const char* trackParam = 0);
|
||||
|
||||
/**
|
||||
* Destroys the dispatcher and the installed handlers.
|
||||
*/
|
||||
~MessageDispatcher();
|
||||
|
||||
/**
|
||||
* Retrieve the tracker parameter name
|
||||
*/
|
||||
inline const String& trackParam() const
|
||||
{ return m_trackParam; }
|
||||
|
||||
/**
|
||||
* Installs a handler in the dispatcher.
|
||||
* The handlers are installed in ascending order of their priorities.
|
||||
|
@ -663,10 +696,19 @@ public:
|
|||
*/
|
||||
void setHook(MessagePostHook* hook, bool remove = false);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Set the tracked parameter name
|
||||
* @param paramName Name of the parameter used in tracking handlers
|
||||
*/
|
||||
inline void trackParam(const char* paramName)
|
||||
{ m_trackParam = paramName; }
|
||||
|
||||
private:
|
||||
ObjList m_handlers;
|
||||
ObjList m_messages;
|
||||
ObjList m_hooks;
|
||||
String m_trackParam;
|
||||
unsigned int m_changes;
|
||||
u_int64_t m_warnTime;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue