Refuse new incoming calls if don't accepted by the driver (engine exiting or full) in sig, iax and jingle modules.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4794 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
e684fa9f8d
commit
f9ac656740
|
@ -2509,6 +2509,15 @@ void SigDriver::handleEvent(SignallingEvent* event)
|
|||
}
|
||||
// No channel
|
||||
if (event->type() == SignallingEvent::NewCall) {
|
||||
if (!canAccept(true)) {
|
||||
Debug(this,DebugWarn,"Refusing new sig call, full or exiting");
|
||||
SignallingMessage* msg = new SignallingMessage;
|
||||
msg->params().addParam("reason","switch-congestion");
|
||||
SignallingEvent* ev = new SignallingEvent(SignallingEvent::Release,msg,event->call());
|
||||
TelEngine::destruct(msg);
|
||||
ev->sendEvent();
|
||||
return;
|
||||
}
|
||||
lock();
|
||||
ch = new SigChannel(event);
|
||||
ch->initChan();
|
||||
|
|
|
@ -1178,11 +1178,18 @@ void YIAXEngine::processEvent(IAXEvent* event)
|
|||
else {
|
||||
if (event->type() == IAXEvent::New) {
|
||||
// Incoming request for a new call
|
||||
connection = new YIAXConnection(this,event->getTransaction());
|
||||
connection->initChan();
|
||||
event->getTransaction()->setUserData(connection);
|
||||
if (!connection->route())
|
||||
event->getTransaction()->setUserData(0);
|
||||
if (iplugin.canAccept(true)) {
|
||||
connection = new YIAXConnection(this,event->getTransaction());
|
||||
connection->initChan();
|
||||
event->getTransaction()->setUserData(connection);
|
||||
if (!connection->route())
|
||||
event->getTransaction()->setUserData(0);
|
||||
}
|
||||
else {
|
||||
Debug(&iplugin,DebugWarn,"Refusing new IAX call, full or exiting");
|
||||
// Cause code 42: switch congestion
|
||||
event->getTransaction()->sendReject(0,42);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -743,7 +743,8 @@ void YJGEngine::processEvent(JGEvent* event)
|
|||
else {
|
||||
if (event->type() == JGEvent::Jingle &&
|
||||
event->action() == JGSession::ActInitiate) {
|
||||
if (event->session()->ref()) {
|
||||
bool ok = plugin.canAccept(true);
|
||||
if (ok && event->session()->ref()) {
|
||||
conn = new YJGConnection(event);
|
||||
conn->initChan();
|
||||
// Constructor failed ?
|
||||
|
@ -752,6 +753,10 @@ void YJGEngine::processEvent(JGEvent* event)
|
|||
else if (!conn->route())
|
||||
event->session()->userData(0);
|
||||
}
|
||||
else if (!ok) {
|
||||
Debug(&plugin,DebugWarn,"Refusing new Jingle call, full or exiting");
|
||||
event->session()->hangup(event->session()->createReason(JGSession::ReasonGeneral));
|
||||
}
|
||||
else {
|
||||
Debug(this,DebugWarn,"Session ref failed for new connection");
|
||||
event->session()->hangup(event->session()->createReason(JGSession::ReasonGeneral));
|
||||
|
|
Loading…
Reference in New Issue