Allow copying arbitrary params when initiating calls from wave or tonegen.

Copy back the peerid if the outbound call starts.


git-svn-id: http://yate.null.ro/svn/yate/trunk@4606 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-09-14 17:03:57 +00:00
parent dc132ec7d0
commit 64120fa92e
2 changed files with 31 additions and 22 deletions

View File

@ -1120,25 +1120,26 @@ bool ToneGenDriver::msgExecute(Message& msg, String& dest)
}
else {
Message m("call.route");
m.addParam("module",name());
m.addParam("cdrtrack",String::boolText(false));
m.copyParam(msg,"called");
m.copyParam(msg,"caller");
m.copyParam(msg,"callername");
String callto(msg.getValue("direct"));
m.copyParams(msg,msg[YSTRING("copyparams")]);
m.clearParam(YSTRING("callto"));
m.clearParam(YSTRING("id"));
m.setParam("module",name());
m.setParam("cdrtrack",String::boolText(false));
m.copyParam(msg,YSTRING("called"));
m.copyParam(msg,YSTRING("caller"));
m.copyParam(msg,YSTRING("callername"));
String callto(msg.getValue(YSTRING("direct")));
if (callto.null()) {
const char *targ = msg.getValue("target");
const char *targ = msg.getValue(YSTRING("target"));
if (!targ)
targ = msg.getValue("called");
targ = msg.getValue(YSTRING("called"));
if (!targ) {
Debug(DebugWarn,"Tone outgoing call with no target!");
return false;
}
callto = msg.getValue("caller");
if (callto.null())
callto << prefix() << dest;
m.setParam("called",targ);
m.setParam("caller",callto);
if (!m.getValue(YSTRING("caller")))
m.setParam("caller",prefix() + dest);
if ((!Engine::dispatch(m)) || m.retValue().null() || (m.retValue() == "-")) {
Debug(DebugWarn,"Tone outgoing call but no route!");
return false;
@ -1155,6 +1156,7 @@ bool ToneGenDriver::msgExecute(Message& msg, String& dest)
m.userData(tc);
if (Engine::dispatch(m)) {
msg.setParam("id",tc->id());
msg.copyParam(m,YSTRING("peerid"));
tc->deref();
return true;
}

View File

@ -1082,20 +1082,26 @@ bool WaveFileDriver::msgExecute(Message& msg, String& dest)
}
}
Message m("call.route");
m.addParam("module",name());
m.addParam("cdrtrack",String::boolText(false));
String callto(msg.getValue("direct"));
m.copyParams(msg,msg[YSTRING("copyparams")]);
m.clearParam(YSTRING("callto"));
m.clearParam(YSTRING("id"));
m.setParam("module",name());
m.setParam("cdrtrack",String::boolText(false));
m.copyParam(msg,YSTRING("called"));
m.copyParam(msg,YSTRING("caller"));
m.copyParam(msg,YSTRING("callername"));
String callto(msg.getValue(YSTRING("direct")));
if (callto.null()) {
const char *targ = msg.getValue("target");
const char *targ = msg.getValue(YSTRING("target"));
if (!targ)
targ = msg.getValue(YSTRING("called"));
if (!targ) {
Debug(DebugWarn,"Wave outgoing call with no target!");
return false;
}
callto = msg.getValue("caller");
if (callto.null())
callto << prefix() << dest;
m.addParam("called",targ);
m.addParam("caller",callto);
m.setParam("called",targ);
if (!m.getValue(YSTRING("caller")))
m.setParam("caller",prefix() + dest);
if (!Engine::dispatch(m)) {
Debug(DebugWarn,"Wave outgoing call but no route!");
return false;
@ -1104,7 +1110,7 @@ bool WaveFileDriver::msgExecute(Message& msg, String& dest)
m.retValue().clear();
}
m = "call.execute";
m.addParam("callto",callto);
m.setParam("callto",callto);
WaveChan *c = new WaveChan(dest.matchString(2),meth,maxlen,msg.getBoolValue("autorepeat"),msg.getValue("format"));
c->initChan();
if (meth)
@ -1115,6 +1121,7 @@ bool WaveFileDriver::msgExecute(Message& msg, String& dest)
m.userData(c);
if (Engine::dispatch(m)) {
msg.setParam("id",c->id());
msg.copyParam(m,YSTRING("peerid"));
c->deref();
return true;
}