DTMF event handling fixed: keypresses are now handled by the session's (signalling) thread

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@82 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 20 years ago
parent c01807370d
commit 484797c053

@ -616,7 +616,7 @@ void AmDtmfHandler::process(AmEvent *evt)
if (event)
{
DBG("++++ DTMF %d\n", event->event());
m_session->onDtmf(event->event(), event->duration());
m_session->doDtmf(event->event(), event->duration());
}
evt->processed = true;
}

@ -393,6 +393,10 @@ void AmSession::putDtmfAudio(const unsigned char *buf, int size, int user_ts)
m_dtmfEventQueue.putDtmfAudio(buf, size, user_ts);
}
void AmSession::doDtmf(int event, int duration_msec) {
postEvent(new AmSessionDtmfEvent(event, duration_msec));
}
void AmSession::onDtmf(int event, int duration_msec)
{
DBG("AmSession::onDtmf(%i,%i)\n",event,duration_msec);
@ -434,6 +438,12 @@ void AmSession::process(AmEvent* ev)
setStopped();
return;
}
AmSessionDtmfEvent* sess_dtmf_ev = dynamic_cast<AmSessionDtmfEvent*>(ev);
if (sess_dtmf_ev) {
onDtmf(sess_dtmf_ev->event_id, sess_dtmf_ev->getDuration());
return;
}
}

@ -50,9 +50,17 @@ using std::map;
using std::pair;
class AmSessionFactory;
//class AmDialogState;
class AmDtmfEvent;
class AmSessionDtmfEvent : public AmEvent {
int duration_msec;
public:
AmSessionDtmfEvent(int key, int duration_msec)
: AmEvent(key), duration_msec(duration_msec)
{ }
int getDuration() { return duration_msec; }
};
/**
* Signaling plugins must inherite from this class.
@ -285,10 +293,11 @@ public:
bool isDtmfDetectionEnabled() { return m_dtmfDetectionEnabled; }
void setDtmfDetectionEnabled(bool e) { m_dtmfDetectionEnabled = e; }
void putDtmfAudio(const unsigned char *buf, int size, int user_ts);
/** the dtmf detector posts events using this method*/
void doDtmf(int event, int duration_msec);
/** event handler for apps to use*/
virtual void onDtmf(int event, int duration);
/**
* onStart will be called before everything else.
*/

Loading…
Cancel
Save