Added ability to call without routing.
git-svn-id: http://voip.null.ro/svn/yate@334 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
f1e3fae071
commit
c7b665f929
|
@ -290,9 +290,10 @@ bool Connection::processLine(const char *line)
|
|||
writeStr(m_machine ? "%%=call:fail=noarg\n" : "You must specify source and target!\n");
|
||||
return false;
|
||||
}
|
||||
String target = str.substr(pos+1);
|
||||
Message m("call.execute");
|
||||
m.addParam("callto",str.substr(0,pos));
|
||||
m.addParam("target",str.substr(pos+1));
|
||||
m.addParam((target.find('/') > 0) ? "direct" : "target",target);
|
||||
|
||||
if (Engine::dispatch(m))
|
||||
str = (m_machine ? "%%=call:success:" : "Called ") + str + "\n";
|
||||
|
|
|
@ -240,10 +240,10 @@ ToneChan::~ToneChan()
|
|||
|
||||
bool ToneGenDriver::msgExecute(Message& msg, String& dest)
|
||||
{
|
||||
Channel *dd = static_cast<Channel*>(msg.userData());
|
||||
if (dd) {
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userData());
|
||||
if (ch) {
|
||||
ToneChan *tc = new ToneChan(dest);
|
||||
if (dd->connect(tc))
|
||||
if (ch->connect(tc))
|
||||
tc->deref();
|
||||
else {
|
||||
tc->destruct();
|
||||
|
@ -251,31 +251,38 @@ bool ToneGenDriver::msgExecute(Message& msg, String& dest)
|
|||
}
|
||||
}
|
||||
else {
|
||||
const char *targ = msg.getValue("target");
|
||||
if (!targ) {
|
||||
Debug(DebugWarn,"Tone outgoing call with no target!");
|
||||
return false;
|
||||
}
|
||||
Message m("call.route");
|
||||
m.addParam("module","tone");
|
||||
m.addParam("caller",dest);
|
||||
m.addParam("called",targ);
|
||||
if (Engine::dispatch(m)) {
|
||||
m = "call.execute";
|
||||
m.addParam("callto",m.retValue());
|
||||
m.retValue().clear();
|
||||
ToneChan *tc = new ToneChan(dest);
|
||||
m.setParam("targetid",tc->id());
|
||||
m.userData(tc);
|
||||
if (Engine::dispatch(m)) {
|
||||
tc->deref();
|
||||
return true;
|
||||
m.addParam("module",name());
|
||||
String callto(msg.getValue("direct"));
|
||||
if (callto.null()) {
|
||||
const char *targ = msg.getValue("target");
|
||||
if (!targ) {
|
||||
Debug(DebugWarn,"Tone outgoing call with no target!");
|
||||
return false;
|
||||
}
|
||||
Debug(DebugWarn,"Tone outgoing call not accepted!");
|
||||
tc->destruct();
|
||||
callto = msg.getValue("caller");
|
||||
if (callto.null())
|
||||
callto << prefix() << dest;
|
||||
m.addParam("called",targ);
|
||||
m.addParam("caller",callto);
|
||||
if (!Engine::dispatch(m)) {
|
||||
Debug(DebugWarn,"Tone outgoing call but no route!");
|
||||
return false;
|
||||
}
|
||||
callto = m.retValue();
|
||||
m.retValue().clear();
|
||||
}
|
||||
else
|
||||
Debug(DebugWarn,"Tone outgoing call but no route!");
|
||||
m = "call.execute";
|
||||
m.addParam("callto",callto);
|
||||
ToneChan *tc = new ToneChan(dest);
|
||||
m.setParam("targetid",tc->id());
|
||||
m.userData(tc);
|
||||
if (Engine::dispatch(m)) {
|
||||
tc->deref();
|
||||
return true;
|
||||
}
|
||||
Debug(DebugWarn,"Tone outgoing call not accepted!");
|
||||
tc->destruct();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -449,7 +449,7 @@ bool WaveFileDriver::msgExecute(Message& msg, String& dest)
|
|||
|
||||
String ml(msg.getValue("maxlen"));
|
||||
unsigned maxlen = ml.toInteger(0);
|
||||
Channel* ch = static_cast<Channel*>(msg.userData());
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userData());
|
||||
if (ch) {
|
||||
Debug(DebugInfo,"%s wave file '%s'", (meth ? "Record to" : "Play from"),
|
||||
dest.matchString(2).c_str());
|
||||
|
@ -463,33 +463,38 @@ bool WaveFileDriver::msgExecute(Message& msg, String& dest)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const char *targ = msg.getValue("target");
|
||||
if (!targ) {
|
||||
Debug(DebugWarn,"Wave outgoing call with no target!");
|
||||
return false;
|
||||
}
|
||||
Message m("call.route");
|
||||
m.addParam("driver","wave");
|
||||
m.addParam("id",dest);
|
||||
m.addParam("caller",dest);
|
||||
m.addParam("called",targ);
|
||||
if (Engine::dispatch(m)) {
|
||||
m = "call.execute";
|
||||
m.addParam("callto",m.retValue());
|
||||
m.retValue() = 0;
|
||||
WaveChan *c = new WaveChan(dest.matchString(2),meth,maxlen);
|
||||
m.setParam("id",c->id());
|
||||
m.userData(c);
|
||||
if (Engine::dispatch(m)) {
|
||||
c->deref();
|
||||
return true;
|
||||
m.addParam("module",name());
|
||||
String callto(msg.getValue("direct"));
|
||||
if (callto.null()) {
|
||||
const char *targ = msg.getValue("target");
|
||||
if (!targ) {
|
||||
Debug(DebugWarn,"Wave outgoing call with no target!");
|
||||
return false;
|
||||
}
|
||||
Debug(DebugWarn,"Wave outgoing call not accepted!");
|
||||
c->destruct();
|
||||
callto = msg.getValue("caller");
|
||||
if (callto.null())
|
||||
callto << prefix() << dest;
|
||||
m.addParam("called",targ);
|
||||
m.addParam("caller",callto);
|
||||
if (!Engine::dispatch(m)) {
|
||||
Debug(DebugWarn,"Wave outgoing call but no route!");
|
||||
return false;
|
||||
}
|
||||
callto = m.retValue();
|
||||
m.retValue().clear();
|
||||
}
|
||||
else
|
||||
Debug(DebugWarn,"Wave outgoing call but no route!");
|
||||
m = "call.execute";
|
||||
m.addParam("callto",callto);
|
||||
WaveChan *c = new WaveChan(dest.matchString(2),meth,maxlen);
|
||||
m.setParam("targetid",c->id());
|
||||
m.userData(c);
|
||||
if (Engine::dispatch(m)) {
|
||||
c->deref();
|
||||
return true;
|
||||
}
|
||||
Debug(DebugWarn,"Wave outgoing call not accepted!");
|
||||
c->destruct();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue