[pjsip] pjsip problem !!!!!

Nanang Izzuddin nanang at pjsip.org
Mon Mar 2 08:38:36 EST 2009


Hi,

The code seems just fine, so perhaps there is just missing details in
your modification (e.g: ringback_slot value is accidentally changed
somewhere/how), and I doubt that this is pjsip problem. Have you tried
to debug it, e.g: putting breakpoint inside/around stop_ring_back()?

Regards,
nanang


On Fri, Feb 27, 2009 at 11:31 PM, waleed hassn <waleedot2003 at gmail.com> wrote:
> hello there
> i added ringback tone on symbian_ua_gui and it worked successful but
> when call connected i can't stop ring back
> i use this code :
>
> //**************************Start *******************
> void init_ring_back()
>        {
>                //ignore sample per frame
>                samples_per_frame = med_cfg.audio_frame_ptime *
>                                                        med_cfg.clock_rate *
>
> med_cfg.channel_count / 1000;
>                /* Ringback tone (call is ringing) */
>                name = pj_str("ringback");
>                pool = pjsua_pool_create("pjsua-app", 1000, 1000);
>                status = pjmedia_tonegen_create2(pool, &name,
>                                                         med_cfg.clock_rate,
>                                                         med_cfg.channel_count,
>                                                         samples_per_frame,
>                                                         16,
> PJMEDIA_TONEGEN_LOOP,
>                                                         &ringback_port);
>
>                pj_bzero(&tone, sizeof(tone));
>                for (i=0; i<RINGBACK_CNT; ++i) {
>                            tone[i].freq1 = RINGBACK_FREQ1;
>                            tone[i].freq2 = RINGBACK_FREQ2;
>                            tone[i].on_msec = RINGBACK_ON;
>                            tone[i].off_msec = RINGBACK_OFF;
>                }
>                tone[RINGBACK_CNT-1].off_msec = RINGBACK_INTERVAL;
>
>                pjmedia_tonegen_play(ringback_port, RINGBACK_CNT, tone,
>                                             PJMEDIA_TONEGEN_LOOP);
>                status = pjsua_conf_add_port(pool, ringback_port,
>                                                     &ringback_slot);
>
>        }
>
> void start_ring_back(){
>        pjsua_conf_connect(ringback_slot, 0);
> }
> void stop_ring_back()
>        {
>                pjsua_conf_disconnect(ringback_slot, 0);
>                pjmedia_tonegen_rewind(ringback_port);
>        }
> //********************** STOP *****************************************
> and then call the start_ring_back on_call_state() function on case
> PJSIP_INV_STATE_EARLY
> if (ci.role==PJSIP_ROLE_UAC && code==180 &&
>                msg->body == NULL &&
>                ci.media_status==PJSUA_CALL_MEDIA_NONE)
>            {
>            User::InfoPrint(_L("ringBack"));
>            start_ring_back(); //ring_back here
>            }
>
> and then stop the ring back on media_state function :
>
> static void on_call_media_state(pjsua_call_id call_id)
> {
>    pjsua_call_info ci;
>        pjsua_conf_port_id idd;
>    pjsua_call_get_info(call_id, &ci);
>
>    stop_ring_back(); // stop ring back
>
>    if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) {
>        // When media is active, connect call to sound device.
>        pjsua_conf_connect(ci.conf_slot, 0);
>        pjsua_conf_connect(0, ci.conf_slot);
>    }
> }
>
> but on call connected i still hear ringBack :(
> is any solution ???
>
> thanks for attention
> Thanks
>
> _______________________________________________
> 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
>



More information about the pjsip mailing list