Detecting in-band DTMF Digits in Openzap?
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). However, for the E1 PRI card there is no dialtone state, which makes sense as the digits are sent over the D-Channel ('VETO Changing state on 1:1 from UP to 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? Thanks, -alex
On Mon, Aug 10, 2009 at 10:26 PM, Alex Green <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
participants (2)
-
Alex Green
-
Moises Silva