Added support for keypad digits if libpri supports them.

git-svn-id: http://yate.null.ro/svn/yate/trunk@517 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-09-16 20:03:54 +00:00
parent 6edca09346
commit d5c2660051
2 changed files with 25 additions and 3 deletions

View File

@ -396,6 +396,11 @@ void PriSpan::handleEvent(pri_event &ev)
Debug(m_driver,DebugInfo,"Call progressing on channel %d on span %d",ev.proceeding.channel,m_span);
proceedingChan(ev.proceeding.channel);
break;
#endif
#ifdef PRI_EVENT_KEYPAD_DIGIT
case PRI_EVENT_KEYPAD_DIGIT:
digitsChan(ev.digit.channel,ev.digit.digits);
break;
#endif
default:
Debug(m_driver,DebugInfo,"Unhandled PRI event %d",ev.e);
@ -477,7 +482,16 @@ void PriSpan::infoChan(int chan, pri_event_ring &ev)
ev.callingname,ev.callingnum,ev.callingplan);
Debug(m_driver,DebugInfo,"callednum='%s' redirectnum='%s' calledplan=%d",
ev.callednum,ev.redirectingnum,ev.calledplan);
getChan(chan)->gotDigits(ev.callednum);
getChan(chan)->gotDigits(ev.callednum,true);
}
void PriSpan::digitsChan(int chan, const char* digits)
{
if (!validChan(chan)) {
Debug(DebugInfo,"Digits on invalid channel %d on span %d",chan,m_span);
return;
}
getChan(chan)->gotDigits(digits,false);
}
void PriSpan::hangupChan(int chan,pri_event_hangup &ev)
@ -693,12 +707,19 @@ void PriChan::answered()
Engine::enqueue(m);
}
void PriChan::gotDigits(const char *digits)
void PriChan::gotDigits(const char *digits, bool overlapped)
{
if (null(digits)) {
Debug(this,DebugMild,"Received empty digits string in mode %s channel %s (%d/%d)",
(overlapped ? "overlapped" : "keypad"),id().c_str(),m_span->span(),m_chan);
return;
}
Message *m = message("chan.dtmf");
m->addParam("span",String(m_span->span()));
m->addParam("channel",String(m_chan));
m->addParam("text",digits);
if (overlapped)
m->addParam("overlapped","yes");
Engine::enqueue(m);
}

View File

@ -90,6 +90,7 @@ protected:
void restartChan(int chan, bool outgoing, bool force = false);
void ringChan(int chan, pri_event_ring &ev);
void infoChan(int chan, pri_event_ring &ev);
void digitsChan(int chan, const char* digits);
void hangupChan(int chan,pri_event_hangup &ev);
void ackChan(int chan);
void answerChan(int chan);
@ -162,7 +163,7 @@ public:
void ring(pri_event_ring &ev);
void hangup(int cause = 0);
void sendDigit(char digit);
void gotDigits(const char *digits);
void gotDigits(const char *digits, bool overlapped = false);
bool call(Message &msg, const char *called = 0);
bool answer();
void answered();