R: R: R: [Asterisk-Users] How to force G729

Rich Adamson radamson at routers.com
Thu Jun 24 07:01:57 MST 2004


> > "If" I understood your initial objective correctly (and I may not have), 
> > the user's phones are negotiating the codec to be used for each rtp session.
> >
> > Asterisk parameters can be used to dictate rtp sessions between the sip 
> > phone and asterisk, but that won't influence the next step in which the sip
> > phone negotiates a new rtp session directly with the gateway.
> >
> > The gateway and the phone will negotiate a common codec based on 
> > whatever logic those two devices have been programmed with by their 
> > respective manufacturers; asterisk isn't involved.
> >
> > So, it sounds like the issue is understanding the codec selection logic 
> > that has been programmed into the gateway and the phone.
> 
> 
> I think you're getting my point, at least I think so (I'm getting more and more 
confused myself about this...)
> 
> The problem is that the phone negotiates a codec with asterisk when placing the call 
(remember I have all reinvite's set to "no", so the gateway and the phone won't talk 
directly to each other!). This negotiation actually works correctly, because I force the 
phone's codec using "disallow=all; allow=g729" in the SIP phone's peer configuration. 
> 
> The negotiation which doesn't work the way I want is the asterisk-to-gateway part. The 
gateway can talk either ULAW or G729, whatever I tell it, if I "force" it using the 
disallow/allow method in sip.conf. The problem is that I need asterisk to talk to the 
gateway sometimes with ULAW, sometimes with G729, depending on the SIP phone who placed 
the call in the first place.
> 
> What I need is some sort of command which says "OK, now Dial(... @gateway), but force 
G729" (which works *if* I tell asterisk that the gateway supports G729 *only* in 
sip.conf, but we want it to support both codecs, right?). Apparently I can only force the 
codec on incoming channels, not on outgoing channels. Is this really an asterisk 
limitation?
> 

Now I better understand what you're trying to do.

I'm not a programmer, but I'm fairly certain that you can't dynamically
change codec preference within asterisk on a per call basis. However,
just as soon as this gets posted, someone will likely jump all over
that statement and post a way to do it.

I don't think its and incoming vs outgoing issue. For each outgoing call,
an rtp session is established between * and the gateway. That rtp session
goes through a codec negotiation process that automatically selects a
compatible codec based on what's common, and, when multiple choices
are available, some other decision making process (transcode time, quality
or something) that you probably don't have control over on a per call
basis.

So, my guess is you're not going to be able to do what you want.






More information about the asterisk-users mailing list