[Asterisk-Dev] changing codec during call - part 2

Jesse Kaijen jesse at kayen.nl
Wed Mar 2 08:22:22 MST 2005


After some nice digging in the iaxclient-code and the libiax2-code I found a
way to change the codec during a call. 
Iax2 handles is very nice when a client changes the code, because a full
frame is send and in the session the svoiceformat is changed.
Also when a full frame is received with a different codec then before, in
the session the voiceformat is changed.


But there are a few problems that I encountered: 
Codec_out: codec that I send
Codec_in: codec that I receive

I can change Codec_out now in iaxclient: 
       calls[0].format=Codec_out (not nice but good for testing)
       a new encoder is created and IAX2 sends a full-frame

The Codec_in is changed in IAX.session.voiceformat but the change isn't
given to the client. This can be solved if the iaxclient fully understands
IAX.session as in iax.c. Then if decoder_format!=session.voiceformat 
I make new decoder with session.voiceformat

My question is why is the iaxclient kept dumb about the session? Or is that
just laziness?

An other problem I have is that the frames in the jitterbuffer wich are
Codec_in_old are tried to be decoded with codec_in_new. My question to Steve
is: is it possible to put besides the frames also the codec of that frame in
the jitterbuffer? So I won't hear a crack in the audio.


If somebody wants to test the codec switch method or has some questions
please contact me in the #asterisk-dev name:Jackthe







More information about the asterisk-dev mailing list