From: Tzafrir Cohen Date: Tue, 6 Oct 2009 16:17:30 +0000 (+0000) Subject: Make sure digit events are not reported as "ERROR" X-Git-Tag: 11.0.0-beta1~4080 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c3cd2ee458a347a9ff0a3ffb4366137b306b4a3;p=thirdparty%2Fasterisk.git Make sure digit events are not reported as "ERROR" dahdievent_to_analogevent used a simple switch statement to convert DAHDI event numbers to "ANALOG_*" event numbers. However "digit" events (DAHDI_EVENT_PULSEDIGIT, DAHDI_EVENT_DTMFDOWN, DAHDI_EVENT_DTMFUP) are accompannied by the digit in the low word of the event number. This fix makes dahdievent_to_analogevent() return the event number as-is for such an event. This is also required to fix #15924 (in addition to r222108). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222237 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 2477100d5a..8a43bacad1 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -2457,6 +2457,17 @@ static enum analog_event dahdievent_to_analogevent(int event) res = ANALOG_EVENT_DTMFUP; break; default: + switch(event & 0xFFFF0000) { + case DAHDI_EVENT_PULSEDIGIT: + case DAHDI_EVENT_DTMFDOWN: + case DAHDI_EVENT_DTMFUP: + /* The event includes a digit number in the low word. + * Converting it to a 'enum analog_event' would remove + * that information. Thus it is returned as-is. + */ + return event; + } + res = ANALOG_EVENT_ERROR; break; }