Thanks Benny, > - call gets disconnected? I think no. No calls to on_call_state nor on_call_media_state nor on_incomming_call sucess. > - something disconnects your port from the bridge? Who? Not me. > - something in your callbacks blocks the program (e.g. mutex)? mmm no, actually do nothing, no threads, no mutex. > - something stops the sound device from calling the callbacks (try > with --null-audio instead) > - ... ? My port do not use sound card, but could be, how can initialize the library with --null-audio ?(Do pjsua parse itself argv?) thanks Benny! Cheers Manuel El Mi?rcoles, 30 de Abril de 2008, Benny Prijono escribi?: > On Tue, Apr 29, 2008 at 6:44 PM, Manuel Quinteiro > > <mquinteiro at cic-systems.com> wrote: > > Hi! > > > > I have created my own port, every think works ok, but some times, after > > random time the callbacks get_frame and put_frame never call again. > > > > Do you see something rong? > > I looked at the code and it looks fine actually. Could it be any of these? > - call gets disconnected? > - something disconnects your port from the bridge? > - something in your callbacks blocks the program (e.g. mutex)? > - something stops the sound device from calling the callbacks (try > with --null-audio instead) > - ... ? > > Cheers > Benny > > > Some parts of code are: > > > > main() { > > .... > > status = pjsua_create(); > > /* Init pjsua */ > > { > > pjsua_config cfg; > > pjsua_logging_config log_cfg; > > pjsua_config_default(&cfg); > > cfg.cb.on_incoming_call = &on_incoming_call; > > cfg.cb.on_call_media_state = &on_call_media_state; > > cfg.cb.on_call_state = &on_call_state; > > > > pjsua_logging_config_default(&log_cfg); > > log_cfg.console_level = 0; > > > > > > status = pjsua_init(&cfg, &log_cfg, NULL); > > > > if (status != PJ_SUCCESS) error_exit("Error in > > pjsua_init()", status); } > > > > pjmedia_myprot_port_create(pjsua_var.pool, 44100, 1,288, 16, > > &myport, serverPort); > > > > pjsua_conf_add_port(pjsua_var.pool, myport, &numPort); > > . > > . > > } > > > > > > static void on_call_media_state(pjsua_call_id call_id) > > { > > pjsua_call_info ci; > > > > pjsua_call_get_info(call_id, &ci); > > if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) { > > pjsua_conf_connect(ci.conf_slot, numPort); > > pjsua_conf_connect(numPort, ci.conf_slot); > > } > > } > > > > > > PJ_DEF(pj_status_t) pjmedia_ucog_port_create( pj_pool_t *pool, > > unsigned sampling_rate, > > unsigned channel_count, > > unsigned samples_per_frame, > > unsigned bits_per_sample, > > pjmedia_port **p_port, > > int mixerPort) > > { > > > > pjmedia_port *port; > > const pj_str_t name = pj_str("ucog-port"); > > > > PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL); > > > > port = PJ_POOL_ZALLOC_T(pool, pjmedia_port); > > PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM); > > > > pjmedia_port_info_init(&port->info, &name, SIGNATURE, > > sampling_rate, channel_count, bits_per_sample, samples_per_frame); > > > > port->get_frame = &ucog_get_frame; > > port->put_frame = &ucog_put_frame; > > port->on_destroy = &ucog_on_destroy; > > > > ntrama=0; > > *p_port = port; > > > > > > slen=sizeof(si_other); > > > > . > > . > > . > > > > // Creamos Feedback para el interlocutor. > > > > for(int i=0;i< 44100;i++){ > > senalSeno[i]= sin(i/11)*15000; > > } > > txframe=0; > > return PJ_SUCCESS; > > } > > > > > > static pj_status_t ucog_put_frame(pjmedia_port *this_port, > > const > > pjmedia_frame *frame) { > > PJ_UNUSED_ARG(this_port); > > PJ_UNUSED_ARG(frame); > > > > if(frame->type==1) { > > procFrame(frame->buf, frame->size); > > } > > return PJ_SUCCESS; > > } > > > > > > static pj_status_t ucog_get_frame(pjmedia_port *this_port, > > > > pjmedia_frame *frame) { > > > > frame->type = PJMEDIA_FRAME_TYPE_AUDIO; > > frame->size = this_port->info.samples_per_frame * 2; > > frame->timestamp.u32.lo += this_port->info.samples_per_frame; > > memcpy(frame->buf, senalSeno, frame->size); > > txframe++; > > return PJ_SUCCESS; > > } > > > > > > -- > > Manuel > > > > > > _______________________________________________ > > 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 > > _______________________________________________ > 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 -- Manuel Quinteiro Compa??a de Instrumentaci?n y control, S.L. Mar?a Auxiliadora, 5 Tlf. +34 91 4595490 Fax. +34 91 4508667 e-mail: mquinteiro at cic-systems.com