答复: PJSIP How to detect inband DTMF (no rfc2833)

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

 



Dear Eize,

    Can you give me some sample code " alike the "wav-writer"-plugin ",Sorry I'm a new man in pjsip project.

    Thank you very much.

Best Regards.

________________________________
???: Eize Slange <eize.slange at gmail.com>
????: 2016?2?17? 8:42
???: pjsip at lists.pjsip.org
??: gyy2046 at outlook.com
??: Re: PJSIP How to detect inband DTMF (no rfc2833?

Hello Gou Yangyan,

I think the way you want to implement it is the complicated way.
The best route is (I think) using SpanDSP library. This library contains a very good in-band DTMF detection, including prevention of false DTMF detection. SpanDSP is actually a quite big library which includes also fax functionality. But you only need the DTMF detection parts, which you can take out of the library (which is what I did).

You can easily integrate it alike the "way-writer"-plugin and also use it that way.
You only need to initialize it and then feed the SpanDSP-detection routine with the frames you receive. No special manipulation on the frames is required.

Some people and myself already implemented it this way, and it works like a charm.

With regards,
Eize


On Tue, Feb 16, 2016 at 6:00 PM, <pjsip-request at lists.pjsip.org<mailto:pjsip-request at lists.pjsip.org>> wrote:

From: gou yangyang <gyy2046@xxxxxxxxxxx<mailto:gyy2046 at outlook.com>>
To: "pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>" <pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>>
Cc:
Date: Tue, 16 Feb 2016 03:04:06 +0000
Subject: PJSIP How to detect inband DTMF (no rfc2833?

Dear ALL,

    Can anyone help me in detect inband DTMF?

    I want to use pjmedia API to get incoming audio data then use spandsp to analysis the DTMF info,But I can not get the incoming RTP data,Can someone help me ?



  The flow is what I have done to get the incoming RTP data .


   1.in<http://1.in> on_call_media_state



pjsua_call_get_info(call_id,&ci);

if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE)
{
buff = (char*)pj_pool_alloc(pool, 1000*sizeof(char));
pjsua_conf_get_port_info(ci.conf_slot,&info);
pjmedia_mem_capture_create(pool,buff,1000,info.clock_rate,
info.channel_count,info.samples_per_frame,info.bits_per_sample,0,&media_port);
//pjmedia_mem_player_set_eof_cb(media_port,buff,cpa_fft_got_data);
pjmedia_mem_capture_set_eof_cb(media_port,buff,cpa_fft_got_data);

pjsua_conf_add_port(pool,media_port,&listen_port);
pjsua_conf_connect(ci.conf_slot,listen_port);

}
2.in<http://2.in> callback cpa_fft_got_data
pj_status_t cpa_fft_got_data(pjmedia_port *port, void *usr_data)
{
pjmedia_frame frame ;
pj_int16_t samplebuf[1024];
frame.buf = samplebuf;
frame.size = 1024;
pjmedia_port_get_frame(port,&frame);
//PJ_LOG(3,(THIS_FILE,"buf buf    %s",usr_data));
if (frame.type== PJMEDIA_FRAME_TYPE_NONE)
{
return 0;
}
       // ....
}

Anyway when I send inband DTMF info by another client in cpa_fft_got_data it shows that
    frame.type == PJMEDIA_FRAE_TYPE_NONE so it will return 0,I can't get any data. So what should I do?

http://comments.gmane.org/gmane.comp.voip.pjsip/9720   this address is the sample which I refered to.


I'm so sorry my english is very poor.

Best Regards.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20160217/4aed4ad6/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