Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poc contributions #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions modules/callfork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ bool ForkMaster::forkSlave(String* dest)
Debug(this,DebugAll,"Call '%s' target '%s' slave '%s' execute succeeded with no peer [%p]",
getPeerId().c_str(),dest->c_str(),tmp.c_str(),this);
ok = false;
// error propagation via lostMaster() does not work in this case. No channel was created, hence no messages are created
m_exec->setParam("error", error);
slave->lostMaster(error);
}
slave->deref();
Expand Down Expand Up @@ -364,6 +366,7 @@ bool ForkMaster::startCalling(Message& msg)
m_rtpForward = msg.getBoolValue("rtp_forward");
m_rtpStrict = msg.getBoolValue("rtpstrict");
if (!callContinue()) {
Debug(&__plugin,DebugNote,"Fork '%s' startCalling() failed. No successful peers", id().c_str());
const char* err = m_exec->getValue("reason");
if (err)
msg.setParam("reason",err);
Expand Down Expand Up @@ -428,8 +431,30 @@ bool ForkMaster::callContinue()
getPeerId().c_str(),dest->c_str(),this);
}
dest->destruct();
if (forks)
break;
if (forks) {
unsigned int regulars = 0;
unsigned int auxiliars = 0;
unsigned int persistents = 0;
for (ObjList* l = m_slaves.skipNull(); l; l = l->skipNext()) {
switch (static_cast<const ForkSlave*>(l->get())->type()) {
case ForkSlave::Auxiliar:
auxiliars++;
break;
case ForkSlave::Persistent:
persistents++;
break;
default:
regulars++;
break;
}
}
if (regulars > 0) {
break;
} else {
clear(true);
forks = persistents;
}
}
m_timer = 0;
m_timerDrop = false;
continue;
Expand Down