Inband-DTMF detection

AR
Archie Rosenblum
Thu, Aug 20, 2009 12:49 PM

Thank you, David.  I'll take a crack at this at some point ,and if I get it
working, I'll share it with the group.

Take care,
Archie

-----Original Message-----
From: pjsip-bounces@lists.pjsip.org [mailto:pjsip-bounces@lists.pjsip.org]
On Behalf Of David Clark
Sent: Saturday, August 15, 2009 7:18 PM
To: pjsip list; 'pjsip list'
Subject: Re: [pjsip] In-band DTMF detection

Ok I have not done inband but I have done FFT and they are similar in
terms of approach.  For inband dtmf check out this algorithm.
http://en.wikipedia.org/wiki/Goertzel_algorithm

Now for how to get the audio data from the conference port source to
the detection algorithm.  Do this.
Just a memory capture device and every time you get a packet of audio
data call this dedection function to determine what dtmf's are
present, then you can call your on_dtmf_callback function for a
seemless interface between inband and non-inband calls.

That is the short answer.

At 01:50 PM 8/15/2009, Archie Rosenblum wrote:

Content-Type: multipart/alternative;
boundary="----=_NextPart_000_000B_01CA1DB7.BED967A0"
Content-Language: en-us

Hi,

Does anyone have an in-band DTMF solution for pjsip?  I know this
question has been raised in the past and I am hoping some
crackerjack coder has figured it out and would like to share it with
the group.  I've been seeing more and more DTMF converted to in-band
through various voip providers and I just not savvy enough to
understand how to code this detection in pjsip.

Any help is appreciated.

Sincerely,
Archie


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org



This email has been scanned by the MxScan Email Security System.


Thank you, David. I'll take a crack at this at some point ,and if I get it working, I'll share it with the group. Take care, Archie -----Original Message----- From: pjsip-bounces@lists.pjsip.org [mailto:pjsip-bounces@lists.pjsip.org] On Behalf Of David Clark Sent: Saturday, August 15, 2009 7:18 PM To: pjsip list; 'pjsip list' Subject: Re: [pjsip] In-band DTMF detection Ok I have not done inband but I have done FFT and they are similar in terms of approach. For inband dtmf check out this algorithm. http://en.wikipedia.org/wiki/Goertzel_algorithm Now for how to get the audio data from the conference port source to the detection algorithm. Do this. Just a memory capture device and every time you get a packet of audio data call this dedection function to determine what dtmf's are present, then you can call your on_dtmf_callback function for a seemless interface between inband and non-inband calls. That is the short answer. At 01:50 PM 8/15/2009, Archie Rosenblum wrote: >Content-Type: multipart/alternative; > boundary="----=_NextPart_000_000B_01CA1DB7.BED967A0" >Content-Language: en-us > >Hi, > >Does anyone have an in-band DTMF solution for pjsip? I know this >question has been raised in the past and I am hoping some >crackerjack coder has figured it out and would like to share it with >the group. I've been seeing more and more DTMF converted to in-band >through various voip providers and I just not savvy enough to >understand how to code this detection in pjsip. > >Any help is appreciated. > >Sincerely, >Archie >_______________________________________________ >Visit our blog: http://blog.pjsip.org > >pjsip mailing list >pjsip@lists.pjsip.org >http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org ---------------------------------------------------------------------------- --------- This email has been scanned by the MxScan Email Security System. ---------------------------------------------------------------------------- ---------
AR
Archie Rosenblum
Tue, Sep 15, 2009 3:37 PM

Would someone mind pointing me in the right direction for capturing audio to
a buffer?  I have multiple inbound calls and I would like to check for
in-band DTMF (no rfc2833). What is the API order for setting up PJSIP to get
the audio data?  I just need some framework help -- I have reviewed the
sample files on the web site but I'm having trouble grasping which APIs to
use. I do know how to do play audio files, it's the capturing to a buffer
that has me confused.  I mostly use the PJSUA APIs.

Global


pjsua_pool_create

[Shared pool used for all calls]

Call comes in (for each call do below)


pjmedia_mem_capture_create

[What size buffer should I use? Does it matter?]

[How do I get the call information such clockrate, etc, so I can set this
API to use the same values as the call?  Does it matter? Or should I use the
values in the sample programs?]

pjmedia_mem_capture_set_eof_cb

[How do I connect the call to this media port for so the media port is
"listening" and the callback works]

Call ends


pjmedia_port_destroy

Thank you in advance,

Archie

Would someone mind pointing me in the right direction for capturing audio to a buffer? I have multiple inbound calls and I would like to check for in-band DTMF (no rfc2833). What is the API order for setting up PJSIP to get the audio data? I just need some framework help -- I have reviewed the sample files on the web site but I'm having trouble grasping which APIs to use. I do know how to do play audio files, it's the capturing to a buffer that has me confused. I mostly use the PJSUA APIs. Global --------- pjsua_pool_create [Shared pool used for all calls] Call comes in (for each call do below) ------------- pjmedia_mem_capture_create [What size buffer should I use? Does it matter?] [How do I get the call information such clockrate, etc, so I can set this API to use the same values as the call? Does it matter? Or should I use the values in the sample programs?] pjmedia_mem_capture_set_eof_cb [How do I connect the call to this media port for so the media port is "listening" and the callback works] Call ends ---------- pjmedia_port_destroy Thank you in advance, Archie
DC
David Clark
Fri, Sep 18, 2009 1:43 AM

At 10:37 AM 9/15/2009, Archie Rosenblum wrote:

Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0088_01CA35F8.E071DB00"
Content-Language: en-us

Would someone mind pointing me in the right direction for capturing
audio to a buffer?  I have multiple inbound calls and I would like
to check for in-band DTMF (no rfc2833). What is the API order for
setting up PJSIP to get the audio data?  I just need some framework
help -- I have reviewed the sample files on the web site but I'm
having trouble grasping which APIs to use. I do know how to do play
audio files, it's the capturing to a buffer that has me confused.  I
mostly use the PJSUA APIs.

Global

pjsua_pool_create
[Shared pool used for all calls]

Call comes in (for each call do below)

pjmedia_mem_capture_create
[What size buffer should I use? Does it matter?]

For FFT analysis I used a buffer size of 2000 bytes.  The idea being
the bigger the buffer size the more accurate the result.  The smaller
the buffer the more real time
the data result.

[How do I get the call information such clockrate, etc, so I can set
this API to use the same values as the call?  Does it matter? Or
should I use the values in the sample programs?]

Yes I think it matters.  I use the pjsua_conf_get_port_info()
function to get this data then pass it along.  It looks something like this:
pjsua_conf_get_port_info(sip_data[line].conf_slot, &info);
sip_data[line].cpa_clock_rate=info.clock_rate;
pjmedia_mem_capture_create(sip_data[line].cpa_pool,
sip_data[line].cpa_int_data, CPA_FFT_SIZE,
info.clock_rate, info.channel_count,
info.samples_per_frame, info.bits_per_sample, 0, &sip_data[line].cpa_port);

pjmedia_mem_capture_set_eof_cb

[How do I connect the call to this media port for so the media port
is "listening" and the callback works]

// line_number is supplied by the application to sort out multiple
line implmentation.
pjmedia_mem_capture_set_eof_cb(sip_data[line].cpa_port,
&sip_data[line].line_number, cpa_fft_got_data);

// add the memory capture port to the bridge
pjsua_conf_add_port(sip_data[line].cpa_pool, sip_data[line].cpa_port,
&sip_data[line].cpa_conf_port);

// then connect the conf_slot for the call and the cpa_conf_slot.
pjsua_conf_connect(sip_data[line].conf_slot, sip_data[line].cpa_conf_port);

The callback function will look like this:
pj_status_t cpa_fft_got_data(pjmedia_port *port, void *usr_data)
{

usr_data will contain the line_number passed int.
Then I think you call pjmedia_port_get_frame(port, frame);
and frame->buf I think has your audio data.

Yea I didn't realize until I typed out this message, my code was 

missing that piece.  So
helping you helped me.
}

Call ends

pjmedia_port_destroy

Thank you in advance,
Archie


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

At 10:37 AM 9/15/2009, Archie Rosenblum wrote: >Content-Type: multipart/alternative; > boundary="----=_NextPart_000_0088_01CA35F8.E071DB00" >Content-Language: en-us > >Would someone mind pointing me in the right direction for capturing >audio to a buffer? I have multiple inbound calls and I would like >to check for in-band DTMF (no rfc2833). What is the API order for >setting up PJSIP to get the audio data? I just need some framework >help -- I have reviewed the sample files on the web site but I'm >having trouble grasping which APIs to use. I do know how to do play >audio files, it's the capturing to a buffer that has me confused. I >mostly use the PJSUA APIs. > >Global >--------- >pjsua_pool_create >[Shared pool used for all calls] > >Call comes in (for each call do below) >------------- >pjmedia_mem_capture_create >[What size buffer should I use? Does it matter?] For FFT analysis I used a buffer size of 2000 bytes. The idea being the bigger the buffer size the more accurate the result. The smaller the buffer the more real time the data result. >[How do I get the call information such clockrate, etc, so I can set >this API to use the same values as the call? Does it matter? Or >should I use the values in the sample programs?] Yes I think it matters. I use the pjsua_conf_get_port_info() function to get this data then pass it along. It looks something like this: pjsua_conf_get_port_info(sip_data[line].conf_slot, &info); sip_data[line].cpa_clock_rate=info.clock_rate; pjmedia_mem_capture_create(sip_data[line].cpa_pool, sip_data[line].cpa_int_data, CPA_FFT_SIZE, info.clock_rate, info.channel_count, info.samples_per_frame, info.bits_per_sample, 0, &sip_data[line].cpa_port); > >pjmedia_mem_capture_set_eof_cb > >[How do I connect the call to this media port for so the media port >is "listening" and the callback works] // line_number is supplied by the application to sort out multiple line implmentation. pjmedia_mem_capture_set_eof_cb(sip_data[line].cpa_port, &sip_data[line].line_number, cpa_fft_got_data); // add the memory capture port to the bridge pjsua_conf_add_port(sip_data[line].cpa_pool, sip_data[line].cpa_port, &sip_data[line].cpa_conf_port); // then connect the conf_slot for the call and the cpa_conf_slot. pjsua_conf_connect(sip_data[line].conf_slot, sip_data[line].cpa_conf_port); The callback function will look like this: pj_status_t cpa_fft_got_data(pjmedia_port *port, void *usr_data) { usr_data will contain the line_number passed int. Then I think you call pjmedia_port_get_frame(port, frame); and frame->buf I think has your audio data. Yea I didn't realize until I typed out this message, my code was missing that piece. So helping you helped me. } > > >Call ends >---------- >pjmedia_port_destroy > > >Thank you in advance, >Archie > >_______________________________________________ >Visit our blog: http://blog.pjsip.org > >pjsip mailing list >pjsip@lists.pjsip.org >http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
AR
Archie Rosenblum
Tue, Sep 22, 2009 6:07 PM

David,

Thank you for the information!  I appreciate the help.

Take care,

Archie

From: pjsip-bounces@lists.pjsip.org [mailto:pjsip-bounces@lists.pjsip.org]
On Behalf Of David Clark
Sent: Thursday, September 17, 2009 9:43 PM
To: pjsip list; 'pjsip list'
Subject: Re: [pjsip] Capture Call Audio to Buffer

At 10:37 AM 9/15/2009, Archie Rosenblum wrote:

Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0088_01CA35F8.E071DB00"
Content-Language: en-us

Would someone mind pointing me in the right direction for capturing audio to
a buffer?  I have multiple inbound calls and I would like to check for
in-band DTMF (no rfc2833). What is the API order for setting up PJSIP to get
the audio data?  I just need some framework help -- I have reviewed the
sample files on the web site but I'm having trouble grasping which APIs to
use. I do know how to do play audio files, it's the capturing to a buffer
that has me confused.  I mostly use the PJSUA APIs.

Global

pjsua_pool_create
[Shared pool used for all calls]

Call comes in (for each call do below)

pjmedia_mem_capture_create
[What size buffer should I use? Does it matter?]

For FFT analysis I used a buffer size of 2000 bytes.  The idea being the
bigger the buffer size the more accurate the result.  The smaller the buffer
the more real time
the data result.

[How do I get the call information such clockrate, etc, so I can set this
API to use the same values as the call?  Does it matter? Or should I use the
values in the sample programs?]

Yes I think it matters.  I use the pjsua_conf_get_port_info() function to
get this data then pass it along.  It looks something like this:
pjsua_conf_get_port_info(sip_data[line].conf_slot, &info);
sip_data[line].cpa_clock_rate=info.clock_rate;
pjmedia_mem_capture_create(sip_data[line].cpa_pool,
sip_data[line].cpa_int_data, CPA_FFT_SIZE,
info.clock_rate, info.channel_count,
info.samples_per_frame, info.bits_per_sample, 0, &sip_data[line].cpa_port);

pjmedia_mem_capture_set_eof_cb

[How do I connect the call to this media port for so the media port is
"listening" and the callback works]

// line_number is supplied by the application to sort out multiple line
implmentation.
pjmedia_mem_capture_set_eof_cb(sip_data[line].cpa_port,
&sip_data[line].line_number, cpa_fft_got_data);

// add the memory capture port to the bridge
pjsua_conf_add_port(sip_data[line].cpa_pool, sip_data[line].cpa_port,
&sip_data[line].cpa_conf_port);

// then connect the conf_slot for the call and the cpa_conf_slot.
pjsua_conf_connect(sip_data[line].conf_slot, sip_data[line].cpa_conf_port);

The callback function will look like this:
pj_status_t cpa_fft_got_data(pjmedia_port *port, void *usr_data)
{

usr_data will contain the line_number passed int.
Then I think you call pjmedia_port_get_frame(port, frame);
and frame->buf I think has your audio data.

Yea I didn't realize until I typed out this message, my code was missing
that piece.  So
helping you helped me.
}

Call ends

pjmedia_port_destroy

Thank you in advance,
Archie


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org



This email has been scanned by the MxScan Email Security System.


David, Thank you for the information! I appreciate the help. Take care, Archie From: pjsip-bounces@lists.pjsip.org [mailto:pjsip-bounces@lists.pjsip.org] On Behalf Of David Clark Sent: Thursday, September 17, 2009 9:43 PM To: pjsip list; 'pjsip list' Subject: Re: [pjsip] Capture Call Audio to Buffer At 10:37 AM 9/15/2009, Archie Rosenblum wrote: Content-Type: multipart/alternative; boundary="----=_NextPart_000_0088_01CA35F8.E071DB00" Content-Language: en-us Would someone mind pointing me in the right direction for capturing audio to a buffer? I have multiple inbound calls and I would like to check for in-band DTMF (no rfc2833). What is the API order for setting up PJSIP to get the audio data? I just need some framework help -- I have reviewed the sample files on the web site but I'm having trouble grasping which APIs to use. I do know how to do play audio files, it's the capturing to a buffer that has me confused. I mostly use the PJSUA APIs. Global --------- pjsua_pool_create [Shared pool used for all calls] Call comes in (for each call do below) ------------- pjmedia_mem_capture_create [What size buffer should I use? Does it matter?] For FFT analysis I used a buffer size of 2000 bytes. The idea being the bigger the buffer size the more accurate the result. The smaller the buffer the more real time the data result. [How do I get the call information such clockrate, etc, so I can set this API to use the same values as the call? Does it matter? Or should I use the values in the sample programs?] Yes I think it matters. I use the pjsua_conf_get_port_info() function to get this data then pass it along. It looks something like this: pjsua_conf_get_port_info(sip_data[line].conf_slot, &info); sip_data[line].cpa_clock_rate=info.clock_rate; pjmedia_mem_capture_create(sip_data[line].cpa_pool, sip_data[line].cpa_int_data, CPA_FFT_SIZE, info.clock_rate, info.channel_count, info.samples_per_frame, info.bits_per_sample, 0, &sip_data[line].cpa_port); pjmedia_mem_capture_set_eof_cb [How do I connect the call to this media port for so the media port is "listening" and the callback works] // line_number is supplied by the application to sort out multiple line implmentation. pjmedia_mem_capture_set_eof_cb(sip_data[line].cpa_port, &sip_data[line].line_number, cpa_fft_got_data); // add the memory capture port to the bridge pjsua_conf_add_port(sip_data[line].cpa_pool, sip_data[line].cpa_port, &sip_data[line].cpa_conf_port); // then connect the conf_slot for the call and the cpa_conf_slot. pjsua_conf_connect(sip_data[line].conf_slot, sip_data[line].cpa_conf_port); The callback function will look like this: pj_status_t cpa_fft_got_data(pjmedia_port *port, void *usr_data) { usr_data will contain the line_number passed int. Then I think you call pjmedia_port_get_frame(port, frame); and frame->buf I think has your audio data. Yea I didn't realize until I typed out this message, my code was missing that piece. So helping you helped me. } Call ends ---------- pjmedia_port_destroy Thank you in advance, Archie _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org ---------------------------------------------------------------------------- --------- This email has been scanned by the MxScan Email Security System. ---------------------------------------------------------------------------- ---------