[Freeswitch-dev] Detecting in-band DTMF Digits in Openzap?

Alex Green alexg at etherstack.com
Thu Aug 20 19:07:50 PDT 2009

Thanks Moises, I am keen to help. Implementing this would require 
architectural changes, which would be better made by people closer to 
and more experienced with freeswitch.

Is there anything wrong with simply disabling DTMF suppression? All 
scenarios I can think of it is not going to matter if the in-band digits 
are passed through whole.

The dirty hack is to comment out the memset line 2042 of zap_io.c, but 
something is also going on in the IVR bridge. I know line 261 and 
onwards in switch_ivr_bridge.c has something to do with it, but I do not 
understand the IVR stuff enough offer anything useful. As a test (not a 
fix!) commenting out the while loop on line 261 (in addition to the 
memset in zap_io.c) fixes the symptoms.

Cheers -alex

Moises Silva wrote:
> I discussed with Mike Jerris some days ago, and as I pointed out we need 
> to be able to tell the duration of the DTMF. At this point libteletone 
> does not help with that (AFAIK), so we need to investigate and fix it. 
> Just haven't found the time to do it. Help is welcomed :-) 
> On Thu, Aug 20, 2009 at 1:58 AM, Alex Green <alexg at etherstack.com 
> <mailto:alexg at etherstack.com>> wrote:
>     Any thought on the email below? I would imagine that passing an analog
>     call through freeswitch is not too uncommon a use-case...
>      >     4.: Potential bug:
>      >     DTMF digit detection *eats some audio* each time a digit is
>     detected. If
>      >     the device is connected directly to free switch this is not a
>     problem.
>      >     If a device makes a call through freeswitch (to let's say
>     phone banking)
>      >     a digit that is held down may be detected as 3 digits
>     (sometimes more)
>      >     due to the consumed audio. This can be heard on the other side of
>      >     freeswitch as a start-stop at the start of the DTMF.
>      >
>      >
>      > Indeed ZAP_CHANNEL_SUPRESS_DTMF causes zap_channel_read to memset the
>      > read data each time a digit hit is found. The problem is that
>     there is
>      > no DTMF_START and DTMF_END events and the DTMF length is lost, we
>     just
>      > have a plain DTMF event for the start. Not sure about how to use
>      > libteletone to detect the DTMF end though.
>      >
>     DTMF suppression is mangling the digits.
>     It took me a while to get to the bottom of this, but it turns out to be
>     very easy to reproduce. Take Freeswitch with an FXS port and a handset.
>     Dial 1000 on the handset and answer the call on a SIP client. Now hold
>     down a digit. You will notice that the digit has a wobble at the start.
>     This is the symptom.
>     Commenting out the DTMF suppression code, changes the behaviour but does
>     not fix the problem. This is what baffled me for a while. I wrote some
>     trivial code that bridges two analog channels by doing a
>     zap_channel_read/write() from one to the other. Commenting out the
>     memset() on line 2042 of zap_io.c produced perfect digits while
>     uncommenting it produced the wobble. The obvious conclusion is that the
>     dodgy digit suppression is being attempted somewhere else (like the SIP
>     side?) and thus the wobble is being introduced at more than one place.
>     This also explains why I (non scientifically) noticed that the more
>     times the call passed through Freeswitch the more incorrectly recognised
>     digits were reported at the final point.
>     I imagine that a solution might be to just turn off DTMF digit
>     suppression by default until it is fixed.
>     Cheers, -alex
>      > Anthony, Mike? care to comment about this one?
>      >
>      > --
>      > Moises Silva
>      > Software Developer
>      > Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham
>     ON L3R
>      > 9T3 Canada
>      > t. 1 905 474 1990 x 128 | e. moy at sangoma.com
>     <mailto:moy at sangoma.com> <mailto:moy at sangoma.com
>     <mailto:moy at sangoma.com>>
>     _______________________________________________
>     FreeSWITCH-dev mailing list
>     FreeSWITCH-dev at lists.freeswitch.org
>     <mailto:FreeSWITCH-dev at lists.freeswitch.org>
>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>     http://www.freeswitch.org
> -- 
> Moises Silva
> Software Developer
> Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 
> 9T3 Canada
> t. 1 905 474 1990 x 128 | e. moy at sangoma.com <mailto:moy at sangoma.com>
> ------------------------------------------------------------------------
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org

More information about the FreeSWITCH-dev mailing list