Need little help here --- Ringtone with APS

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

 





Thanks Benny for your help. It was really insightfull. The good news is
the application initially initialized as PCM mode. I think I know how to
open it up in PCM mode as well. I successfully created the ringtone and
could play it as well. But the bad news is, once ringtone is played I am
unable to disconnect the sound port. The on_stream_created callback suppose to disconnect
that automatically and well it does, but I loose the calles sound. after
that my phone looses sound but i can hear sound in the other side.

The way i did that. I opened up a media port for ring tone. then i
assigned that to conference port with pjsua_conf_add_port. then i connect
the conference id with master conference port id 0. now when i play the
ringtone i can hear.
I think somehow I am missing something
here.?

? #define SAMPLES_PER_FRAME?? 64
??? #define
ON_DURATION???????? 1500
??? #define
OFF_DURATION??????? 2500

?????? 
??? status = pjmedia_tonegen_create2(app_pool, NULL
,8000, 1, SAMPLES_PER_FRAME, 16, 0, &ring_port);
??? if (status != PJ_SUCCESS)??? 
??? ??? return;
?
??? status = pjsua_conf_add_port(
app_pool,ring_port,&c_id);
?
???
pjsua_conf_connect(c_id,0);
??? 
?? 
?? if (status != PJ_SUCCESS) {
????
PJ_LOG(1,(THIS_FILE, "connecting ring port failed to device,
status=%d", status));
???? return;
?? }
? 
?? {

?? pjmedia_tone_desc tones[1];
??????? 
??
tones[0].freq1 = 400;
?? tones[0].freq2 = 0;
?? tones[0].on_msec = ON_DURATION;
??
tones[0].off_msec = OFF_DURATION;

?? status = pjmedia_tonegen_play(ring_port, 1,
tones,1);


/***************************for deinitialization*******************/

?? if (ring_port){
?pjmedia_tonegen_stop(ring_port);
?pjsua_conf_disconnect(0,c_id);
?pjsua_conf_remove_port(c_id);
?pjmedia_port_destroy(ring_port);
?ring_port=NULL;
?return PJ_TRUE;
???? }







> On Sun, Feb 15, 2009 at 8:18 PM, <iajdani at provati.com>
wrote: 
> 
>> I am trying to play ringtone to the
caller at 180 response. What I wrote 
>> in 
>>
on_call_state callback is given below. The code just execute fine but no

>> ringtone in my earpiece. I am now using APS-DIRECT. 
>> 
> 
> First of all, the aps-direct branch is
supposed to be an internal branch 
> and 
> we're not
quite finished with it so expect few rough edges here and there. 
> Even the API is not quite finalized yet, so it's really not ready
to be 
> used 
> for anything. But I do appreciate, and
surprised at the same time, with 
> the 
> level of
interests that this has generated. 
> 
> Answering your
question. When using APS-Direct, you always need to 
> remember

> that the whole point of having APS-Direct is to enable codec
compression 
> in 
> sound device (APS/VAS), hence to let
encoded frames flowing end-to-end 
> from 
> the
microphone down to the socket and vice versa. 
> 
> The
sample on_stream_created() snippet shows how to open the sound device 
> in 
> codec format according to the codec being used by the
call. So since the 
> sound device is opened in codec mode, you
can't no longer feed it with PCM 
> frames (e.g. the tone
generator). 
> 
> To use the tone generator (or any other
pjmedia features that works on PCM 
> frames such as WAV files),
you will need to open the sound device in PCM 
> mode to play the
ring tones, then when you want to communicate with the 
>
call/stream, you will need to close the sound device, and re-open it using

> the codec that is used by the call. 
> 
> The
on_stream_created() snippet currently doesn't show how to do this, so 
> you need to do it yourself. 
> 
> cheers 
>
Benny 
> _______________________________________________ 
> 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 
>


> On Sun, Feb 15, 2009 at 8:18 PM, <iajdani at provati.com>
wrote: > >> I am trying to play ringtone to the caller at 180
response. What I wrote >> in >> on_call_state callback is
given below. The code just execute fine but no >> ringtone in my
earpiece. I am now using APS-DIRECT. >> > > First of all, the
aps-direct branch is supposed to be an internal branch > and > we're
not quite finished with it so expect few rough edges here and there. >
Even the API is not quite finalized yet, so it's really not ready to be
> used > for anything. But I do appreciate, and surprised at the
same time, with > the > level of interests that this has generated.
> > Answering your question. When using APS-Direct, you always need
to > remember > that the whole point of having APS-Direct is to
enable codec compression > in > sound device (APS/VAS), hence to let
encoded frames flowing end-to-end > from > the microphone down to
the socket and vice versa. > > The sample on_stream_created()
snippet shows how to open the sound device > in > codec format
according to the codec being used by the call. So since the > sound
device is opened in codec mode, you can't no longer feed it with PCM >
frames (e.g. the tone generator). > > To use the tone generator (or
any other pjmedia features that works on PCM > frames such as WAV
files), you will need to open the sound device in PCM > mode to play
the ring tones, then when you want to communicate with the >
call/stream, you will need to close the sound device, and re-open it using
> the codec that is used by the call. > > The on_stream_created()
snippet currently doesn't show how to do this, so > you need to do it
yourself. > > cheers > Benny >
_______________________________________________ > 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 >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090216/d777fce4/attachment.html>


[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