Hi, Not really sure what was going on. Please try to put the code of changing output route *after* connecting wav player to the sound device, just to make sure that the pjsua_snd_set_setting() is executed after the audio device is opened. BR, nanang On Mon, Apr 19, 2010 at 3:44 AM, Ricardo <ricardo2500 at hotmail.com> wrote: > Nanang Izzuddin <nanang <at> pjsip.org> writes: > >> >> Hi, >> >> I have no idea about CMdaAudioPlayerUtility API. Just FYI, pjsua >> sample app implements ringtone by creating wave player port and >> register it to the conference bridge (or audio switch when >> APS/VAS-Direct is used). Connecting this port to port 0 will play the >> ringtone, disconnecting it will stop the ringtone. >> >> BR, >> nanang >> >> On Thu, Feb 25, 2010 at 5:15 AM, Ricardo Antonio Ponce Gomez >> <ricardo2500 <at> hotmail.com> wrote: >> > Hi all. >> > I'm trying to play a ring tone when an incomming call is there. I'm using >> > the CMdaAudioPlayerUtility API and it just work fine the first time,?i can >> > hear a .wav audio file in the loudspeaker, but after I finish with this >> > call, and there's a second incomming call my ring tone it's gone. I'm dong >> > something like this: >> > _LIT(tono,"ring.wav"); >> > CPlayer *player = CPlayer::NewL(tono); >> > //on_incoming_call callback >> > .... >> > pjsua_call_answer(call_id, 180, NULL, NULL); >> > player->Play(); >> > .... >> > //on_call_state callback >> > ...... >> > if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { >> > if (call_id == g_call_id){ >> > ?? ? ? ?g_call_id = -1; >> > ?? ? ? ?player->Stop(); >> > ?? ? } >> > ..... >> > Do you think i'm missing something? Is there any other better option to do >> > this? >> > I'm using VAS. >> > Thanks & Regards >> > ________________________________ >> > ?Te falta espacio para tus correos? Enciende tu hotness con Hotmail >> > _______________________________________________ >> > 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 >> > >> > >> >> > Hi, > Thanks Nanang for your help. Now I'm facing a similar problem creating the wav > player in this way: > > pjsua_player_id player_id; > > in on_incoming_call callback. > .... > .... > pj_str_t awav = pj_str ("C:\\Data\\ring.wav"); > ? ?status =pjsua_player_create(&awav,0,&player_id); > if (status != PJ_SUCCESS) > ? ?console->Printf(_L("\n->error creando player\n")); > status=pjsua_conf_connect(pjsua_player_get_conf_port(player_id),0); > > > And then I disconnect the conference in on_call_state and in on_call_media_state > callbacks. > > With this code I can hear the ringtone when I get an incomming call, the problem > is that when the call is finished the next time I get an incomming call my > ringtone is played in the earpiece instead of the Loudspeaker. Then, if ?I hang > up the call before answer it, the next time I have an incomming call the > Ringtone is played in the Loudspeaker again. > > So I tried adding this before I connect the wav player to the conference: > > pjmedia_aud_dev_route route; > route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER; > status = > pjsua_snd_set_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,&route,PJ_FALSE); > if (status != PJ_SUCCESS) > ? ?console->Printf(_L("\nError cambiando a altavoz\n")); > > But I allways get the same result. Do you have any idea about what could be my > problem? > > Thanks in advance for any help. > > > > > _______________________________________________ > 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 >