[asterisk-dev] Sending digits directly to Asterisk using DAHDI during ramal dialing

Tzafrir Cohen tzafrir.cohen at xorcom.com
Wed Feb 3 03:28:01 CST 2016


On Wed, Jan 20, 2016 at 05:19:59PM -0300, Fábio Urquiza wrote:
> Hi All,
> 
> I'm still developing a DAHDI driver to a specific PABX hardware that is
> composed by a Digital Matrix controlled by a DSP. I already have sent a
> message to the list with some questions about DAHDI developing and received
> some very good advices. Now I'm facing a new problem.
> 
> In this particular hardware the DSP is responsible for receiving all events
> that happen in all cards. So, for instance, if a ramal connected to a FXS
> card have its phone off hook, the DSP send us a message like the one below:
> 
> Mbx: [a] Ev: [17],0,1 => Ramal 0 offhook
> 
> I understand that my driver need to call something like this when that
> event is generated:
> 
> dahdi_hooksig(chan, DAHDI_RXSIG_OFFHOOK);
> 
> After that, when digit in the ramal are been pressed, the DSP already does
> the DTMF detection and send us messages like that:
> 
> Mbx: [ff] Ev: [dc],0,30 => Digit 0x30 '0' detected
> 
> Mbx: [ff] Ev: [dc],0,31 => Digit 0x31 '1' detected
> 
> 
> Now my driver need to call a function to directly send the detected digits
> to DAHDI. But I looked all *kernel.h* and *dahdi-base.c* and didn't found a
> function to do that.

Interfaces to userspace are in user.h .

> 
> I imagine that in the normal operation Asterisk will be waiting for the
> tones to do the DTMF itself. There is a way that I can send the digits
> directly using DAHDI API and skip the Asterisk DTMF detection ?

$ grep -A2 PULSEDIGIT include/dahdi/user.h
#define DAHDI_EVENT_PULSEDIGIT          (1 << 16)       /* This is OR'd with the digit received */
#define DAHDI_EVENT_DTMFDOWN            (1 << 17)       /* Ditto for DTMF key down event */
#define DAHDI_EVENT_DTMFUP              (1 << 18)       /* Ditto for DTMF key up event */

Pulse digit detection is handled by DAHDI. You may have encountered the
funny message "Got pulse digit NNN" for values of NNN way larger than 10
if you have a misconfigured phone/line (or badly-written driver).

Reporting DTMF up and DTMF down is left for various drivers to
implement, if they choose to. As you can see, there are currently two
drivers that may send those events.

See also DAHDI_TONEDETECT .

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com



More information about the asterisk-dev mailing list