Inband-DTMF detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 20, 2008 at 1:43 PM, Maarten Sander
<info at privateer-software.nl>wrote:

> Hello,
>
> I'm developing a call-center application using PJSIP (actually, mostly
> PJSUA) and currently I'm trying to implement an inband-DTMF detector port
> (I can't rely on SIP INFO messages).
>
> Right now, I'm using SpanDSP for reading DTMF digits.  However, it doesn't
> seem to work (no digits are received).  Has anyone tried to integrate
> SpanDSP and PJSIP before?
>
>
Could you explain exactly what you mean by "doesn't work"?


> Currently, I'm feeding the samples as-is to SpanDSP, and I'm relying on
> SpanDSP's callback mechanism to receive the digits:
>
>  static pj_status_t dtmfdet_put_frame(pjmedia_port *this_port,
>                                       const pjmedia_frame *frame)
>  {
>    struct dtmfdet_port *dport = (struct dtmfdet_port*) this_port;
>    dtmf_rx(&dport->state, (const pj_int16_t*) frame->buf,
>            dport->base.info.samples_per_frame);
>    return PJ_SUCCESS;
>  }
>
>
Not knowing SpanDSP, that looks fine. But perhaps you'd want to handle the
case where frame->type is not FRAME_TYPE_AUDIO (i.e. just ignore them if
it's not audio).


 static void dtmfdet_digits_rx(void *user_data, const char *digits,
>                                int len)
>  {
>    struct dtmfdet_port *dport = (struct dtmfdet_port*) user_data;
>    int i;
>
>    if (dport->cfg.cb.on_dtmf_digit != NULL) {
>      for (i = 0; i < len; i++) {
>        dport->cfg.cb.on_dtmf_digit(dport->cfg.call_id, digits[i]);
>      }
>    }
>  }
>
> Is this the right way to do it?  Should I convert the samples?  I'm
> assuming the frame contains linear samples, and as far as I can tell,
> SpanDSP expects them to be linear.
>
>
The frame should contain linear samples.

Cheers
 Benny



> Thanks for your help.
>
> Regards,
>
> Maarten
>
> P.S. I've also tried to implement the Goertzel algorithm
> (http://en.wikipedia.org/wiki/Goertzel_algorithm) directly, but it didn't
> work out, so I thought it would be wise to try integrating SpanDSP first.
> Eventually, I'd like to get rid of the SpanDSP dependency, and use Goertzel
> directly.
>
> --
> Privateer Software Development (www.privateer-software.nl)
> * web usability, web accessibility, web development
> * cross-platform software development
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080820/d6fa6ac9/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux