Re: [Freeswitch-dev] Detecting in-band DTMF Digits in Openzap?
Thanks Moises, do I need to do a flush_dtmf() or set values for DTMF on/off period, or anything else? zap_channel_dequeue_dtmf() correctly identifies the digit, but if the digit is held down it is detected more than once. I am using a frame size of 160 for the read. Thanks again, -alex Moises Silva wrote:
On Mon, Aug 10, 2009 at 10:26 PM, Alex Green <alexg@etherstack.com <mailto:alexg@etherstack.com>> wrote:
For FXO I switch back to the dialtone state and collect the digits via the ZAP_SIGEVENT_COLLECTED_DIGIT call back (which is a little bit ugly and does not allow dial ahead, but it works).
Sounds way too ugly, I don't think you should be doing that.
DIALTONE' is printed if you try). Openzap must be able to detect digits during a call, but I am having trouble figuring out how.
ie. How do you use Openzap to detect in-band DTMF digits during a call?
Take a look at mod_openzap/mod_openzap.c, on_clear_channel_signal()
It seem to me you should do the same.
zap_channel_command(sigmsg->channel, ZAP_COMMAND_ENABLE_DTMF_DETECT, &tt); where tt = ZAP_TONE_DTMF and sigmsg->channel is the zap_channel_t
That will enable the DTMF detection feature in the channel (either in software or hardware if its available).
After enabling that feature, you can use zap_channel_dequeue_dtmf(zchan, dtmf, sizeof(dtmf)); to dequeue DTMF after calling zap_channel_read(), since there is where dtmf (if any) is enqueued. Check zap_channel_read so you can see how the DTMF is detected and enqueued.
If you don't want to call zap_channel_dequeue_dtmf on each read (or you can't), then register an event callback for the span with zap_span_set_event_callback(), then your code will be called with ZAP_EVENT_DTMF when dtmf is received in any channel on that span.
Hope that helps,
-- 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@sangoma.com <mailto:moy@sangoma.com>
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
On Tue, Aug 11, 2009 at 1:17 AM, Alex Green <alexg@etherstack.com> wrote:
Thanks Moises, do I need to do a flush_dtmf() or set values for DTMF on/off period, or anything else?
I think default on/off times are good enough, but I suppose you may have to play with it. As of flushing, sounds like a good idea to do when the call starts, but that depends on your applications, if you are certain of consuming all DTMF always, then is not needed. Are you using hw dtmf? are you using Sangoma boards? I noticed that openzap behavior will be different from an API point of view when using hardware DTMF than when using software DTMF, since the callbacks (for span and channel) are currently not available when using hardware DTMF. That sounds like a bug to me, the behavior should be available regardless of the backend system used for DTMF. I will fix that asap.
zap_channel_dequeue_dtmf() correctly identifies the digit, but if the digit is held down it is detected more than once. I am using a frame size of 160 for the read.
More than once like in twice? 3 times, 4 times? ad infinitum if the digit is hold? I'd need to debug to try to figure out where that comes from. If you are using hardware dtmf in wanpipe boards you can go to src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c and search for WP_TDMAPI_EVENT_DTMF, then uncomment the log line there to see if the digit is detected twice by the drivers. If using software DTMF, some logging in zap_channel_read when calling teletone_dtmf_detect() can be added to check if its detecting it twice. -- 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@sangoma.com
participants (2)
-
Alex Green
-
Moises Silva