ring back tone !!!

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

 



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



[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