Fixed chan.dtmf sending: use the active channel if none specified.

git-svn-id: http://yate.null.ro/svn/yate/trunk@3318 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-05-13 13:34:42 +00:00
parent 4b92b14b56
commit 401917ee8e
2 changed files with 9 additions and 7 deletions

View File

@ -2363,12 +2363,14 @@ bool Client::ringer(bool in, bool on)
// Send DTMFs on selected channel
bool Client::emitDigits(const char* digits, const String& id)
{
Debug(ClientDriver::self(),DebugInfo,"emitDigit(%s,%s)",digits,id.c_str());
XDebug(ClientDriver::self(),DebugAll,"Client::emitDigits(%s,%s)",digits,id.c_str());
if (!driverLockLoop())
return false;
ClientChannel* chan = static_cast<ClientChannel*>(ClientDriver::self()->find(id));
Channel* chan = !id ? ClientDriver::self()->find(ClientDriver::self()->activeId()) :
ClientDriver::self()->find(id);
bool ok = (0 != chan);
if (ok) {
Debug(chan,DebugAll,"emitDigits(%s) [%p]",digits,chan);
Message* m = chan->message("chan.dtmf");
m->addParam("text",digits);
Engine::enqueue(m);

View File

@ -1041,16 +1041,16 @@ bool DefaultLogic::callStart(NamedList& params, Window* wnd)
// function which is called when a digit is pressed
bool DefaultLogic::digitPressed(NamedList& params, Window* wnd)
{
if (!Client::self())
if (!Client::valid())
return false;
// Send digits (DTMF) on active channel
// or add them to 'callto' box
String digits = params.getValue("digits");
if (digits && ClientDriver::self() && ClientDriver::self()->activeId()) {
Client::self()->emitDigits(digits,ClientDriver::self()->activeId());
const String& digits = params["digits"];
if (!digits)
return false;
if (Client::self()->emitDigits(digits))
return true;
}
String target;
if (isE164(digits) && Client::self()->getText("callto",target)) {
target += digits;