Inband-DTMF detection

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

 



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?

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;
  }

  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.

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




[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