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> wrote: > > From: gou yangyang <gyy2046@xxxxxxxxxxx> > To: "pjsip at lists.pjsip.org" <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 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 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/71171f97/attachment.html>