[Asterisk-Dev] Early media in H.323 driver

Chih-Wei Huang cwhuang at citron.com.tw
Mon Mar 28 02:44:10 MST 2005


Paul Cadach wrote:
> 
> This is because:
> 1) H.323 allows different codec negotiated for opposite voice path while Asterisk have single codec for channel;

Yes in theoretically, but in my test environment,
both the forward and reverse path use the same codec(G.723.1).

For the codec in Asterisk channel, it's still a mystery to me.
It seems there are several variables associated with the codec of
a channel: nativeformats, rawreadformat, readformat, rawwriteformat,
writeformat. And some of them(readformat/writeformat ?)
are changed during a call.
Could someone explain them?

> 2) There is missed codec negotiation (???, not verified) between OpenH323 stack and Asterisk, so translation couldn't be
> set up correctly.
> 3) Asterisk currently isn't have codec preferences, so it could interfere with 1) and 2).
> 
> Usage of translation within oh323_write is complicated because state of the locks is unknown (sometime it calls with
> locks held, sometime without ones).

As I tested, when A dials B, Asterisk generatd a local ringback tone
to A. But when B sent early media packets to Asterisk, it
stopped the local ringback tone and tried to pass back the early
media packes, but failed due to codec imcompatible.

I also observed if I asked oh323_write to ignore imcompatible
packets by changing the block

   if (!(frame->subclass & c->nativeformats)) {
         ast_log(LOG_WARNING, ...
         return -1;  <== change to 0
   }

The call would not be hangup, but A can't hear the ringback
tone from B (as expected).
However, when B answered the call, A and B could talk without problem.
It seems when a call be answered, Asterisk adjusts the
read or writeformat of the channel(s) so A and B can be connected.

I guess we can have Asterisk to adjust the read/writeformat of channels
when received early media packets to allow the early media be passed
back to A, just like the call be answered.
But I don't know how to do that.
(I know how to detect early media packets in Openh323,
but I don't know how to tell Asterisk. Any help?)


-- 
   ~     Chih-Wei Huang (cwhuang at citron.com.tw)
  'v'    CTO, Citron Network Inc. ( http://www.citron.com.tw/ )
 // \\   GnuGK Project : http://www.gnugk.org/    (Developer)
/(   )\  HomePage      : http://www.linux.org.tw/~cwhuang/
 ^`~'^



More information about the asterisk-dev mailing list