Rich Adamson
2006-Aug-07 05:37 UTC
[asterisk-users] Re: [asterisk-dev] Questions regarding g.729 and g.711 in Asterisk
Chan Kwang Mien wrote:> Thanks. By setting allow=g729, sip1 was able to connect to sip2. > > Does that mean that Asterisk chooses the codec to be used between the > Caller and Callee ? In this case, since sip1 informs Asterisk that it > supports g.711 and g.729, Asterisk chooses g.729 since the Callee also > supports g.729. From the SIP Messages exchange, it doesn't seem that > Asterisk chooses the codec. > > My previous setting was "allow=all". I was expecting "allow=all" to work > since that would also imply "allow=g729", isn't it ?This really belongs on the -users list since it doesn't deal with developing code. Moving it there now. Each sip phone essentially negotiates a codec independently with asterisk, and not as an end-to-end conversation. When sip1 initiates a call, it exchanges sip packets with asterisk to select a compatible codec. When asterisk places the call to sip2, it exchanges sip packets with sip2 to select a compatible codec and it has nothing to do with what sip1 negotiated. You have two choices to correct the behavior. One, change the asterisk definitions so as to show a preference (disallow=all, allow=g729,ulaw), or, two, change the sip phone's definition to prefer g729 as its first choice. Even though many sip phones support multiple codecs, the negotiation is very simple in that it offers up its first choice codec (only), and if asterisk supports that first choice, that's what is used. Highly dependent on the sip phone manufacturers coding.
Olle E Johansson
2006-Aug-07 11:02 UTC
[asterisk-users] Re: [asterisk-dev] Questions regarding g.729 and g.711 in Asterisk
7 aug 2006 kl. 14.37 skrev Rich Adamson:> Chan Kwang Mien wrote: >> Thanks. By setting allow=g729, sip1 was able to connect to sip2. >> Does that mean that Asterisk chooses the codec to be used between the >> Caller and Callee ? In this case, since sip1 informs Asterisk that it >> supports g.711 and g.729, Asterisk chooses g.729 since the Callee >> also >> supports g.729. From the SIP Messages exchange, it doesn't seem that >> Asterisk chooses the codec. >> My previous setting was "allow=all". I was expecting "allow=all" >> to work >> since that would also imply "allow=g729", isn't it ? > > This really belongs on the -users list since it doesn't deal with > developing code. Moving it there now. > > Each sip phone essentially negotiates a codec independently with > asterisk, and not as an end-to-end conversation.Not "a" codec - many codecs.> > When sip1 initiates a call, it exchanges sip packets with asterisk > to select a compatible codec. When asterisk places the call to > sip2, it exchanges sip packets with sip2 to select a compatible > codec and it has nothing to do with what sip1 negotiated.Well, this is changing. With new RFCs they have something to do with what SIP1 offered. Note that * More than one codec can be "approved" for a call. Each UA can then freely switch between the codecs during a call without a re-invite. * Different codecs can be used in each direction> > You have two choices to correct the behavior. One, change the > asterisk definitions so as to show a preference (disallow=all, > allow=g729,ulaw), or, two, change the sip phone's definition to > prefer g729 as its first choice.Or use the SIP_CODEC variable in the dialplan to set a prefered codec for the call.> > Even though many sip phones support multiple codecs, the > negotiation is very simple in that it offers up its first choice > codec (only), and if asterisk supports that first choice, that's > what is used. Highly dependent on the sip phone manufacturers coding.Yes. Asterisk has some interesting behaviour too, that we will have to change to comply with recent standards. /O --- * Olle E. Johansson - oej@edvina.net * Asterisk Training http://edvina.net/training/