Allow setting the handler tracking name by individual external scripts.

This must be set before installing the handlers.


git-svn-id: http://voip.null.ro/svn/yate@5123 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-06-15 11:19:31 +00:00
parent 42e83cdc11
commit 55d79930e8
3 changed files with 14 additions and 3 deletions

View File

@ -201,6 +201,7 @@ For read-only parameters you must provide an empty value.<br />
<b>Currently supported parameters:</b><br />
id (string) - Identifier of the associated channel, if any<br />
disconnected (bool) - Enable or disable sending &quot;chan.disconnected&quot; messages<br />
trackparam (string) - Set the message handler tracking name, cannot be made empty<br />
reason (string) - Set the disconnect reason that gets received by the peer channel<br />
timeout (int) - Timeout in milliseconds for answering to messages<br />
timebomb (bool) - Terminate this module instance if a timeout occured<br />

View File

@ -264,6 +264,7 @@ private:
String m_script, m_args;
ObjList m_waiting;
ObjList m_relays;
String m_trackName;
String m_reason;
};
@ -716,7 +717,7 @@ ExtModReceiver::ExtModReceiver(const char* script, const char* args, File* ain,
m_in(0), m_out(0), m_ain(ain), m_aout(aout),
m_chan(chan), m_watcher(0), m_selfWatch(false), m_reenter(false), m_setdata(true),
m_timeout(s_timeout), m_timebomb(s_timebomb), m_restart(false),
m_script(script), m_args(args)
m_script(script), m_args(args), m_trackName(s_trackName)
{
Debug(DebugAll,"ExtModReceiver::ExtModReceiver(\"%s\",\"%s\") [%p]",script,args,this);
m_script.trimBlanks();
@ -733,7 +734,7 @@ ExtModReceiver::ExtModReceiver(const char* name, Stream* io, ExtModChan* chan, i
m_in(io), m_out(io), m_ain(0), m_aout(0),
m_chan(chan), m_watcher(0), m_selfWatch(false), m_reenter(false), m_setdata(true),
m_timeout(s_timeout), m_timebomb(s_timebomb), m_restart(false),
m_script(name)
m_script(name), m_trackName(s_trackName)
{
Debug(DebugAll,"ExtModReceiver::ExtModReceiver(\"%s\",%p,%p) [%p]",name,io,chan,this);
m_script.trimBlanks();
@ -1296,7 +1297,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,s_trackName);
MessageRelay *r = new MessageRelay(id,this,0,prio,m_trackName);
if (fname)
r->setFilter(fname,fvalue);
m_relays.append(r);
@ -1362,6 +1363,7 @@ bool ExtModReceiver::processLine(const char* line)
int col = id.find(':');
if (col > 0) {
String val(id.substr(col+1));
val.trimBlanks();
id = id.substr(0,col);
bool ok = false;
Lock mylock(this);
@ -1379,6 +1381,13 @@ bool ExtModReceiver::processLine(const char* line)
val = m_chan->disconn();
ok = true;
}
else if (id == "trackparam") {
if (val.null())
val = m_trackName;
else
m_trackName = val;
ok = true;
}
else if (id == "reason") {
m_reason = val;
ok = true;

View File

@ -275,6 +275,7 @@ $n = round(1 * Yate::Arg());
if ($n >= 2)
$ban_failures = $n;
Yate::SetLocal("trackparam","banbrutes");
Yate::Watch("user.auth");
Yate::Install("user.authfail",120);
Yate::Install("engine.timer",150);