[Asterisk-Users] Forcing a codec

Kevin Walsh kevin at cursor.biz
Fri Oct 1 14:04:16 MST 2004


Eric [eric at monmouth.com] wrote:
> I'm having trouble explicitly forcing a codec between sip devices.  Am
> I missing something or is this not really possible?
> 
> I have a grandstream registering to asterisk, named sip0.  Sip0 registers,
> via sip, to another asterisk box, sip1.  When I place a call from the
> grandstream, it will travel through sip0 to sip1, where it is then placed
> to the PSTN.  Nothing can reinvite, this path is forced for the entire
> call. 
> 
>  +--------+         +--------+         +--------+
>  |   gs   | <-----> |  sip0  | <-----> |  sip1  |
>  +--------+         +--------+         +--------+
> 
> I would like the RDP traffic between the gs and sip0 to be encoded using
> ILBC and the traffic between sip0 and sip1 to use G.711.  I can force the
> gs/sip0 path to ILBC be allowing only that codec in the gs's sip config,
> however, even when I specify in the sip config that sip1 can only use
> ulaw, it uses ILBC, as observed from a `sip show peers`.  sip1 allows
> both ILBC and ULAW. 
> 
> Is there any way to force sip0 to reencode the audio stream?
> 
> sip0 is running asterisk 1.0.1 and the gs is the latest 1.0.5.11 code.
> sip1 is running an older CVS version.
> 
You may find that the "gs" and "sip1" are sending RTP packets directly
between one another using ilbc anyway.  If this is the case, and you
don't want that to happen, then add "canreinvite = no" to the "gs"
user entry in the sip.conf file on "sip0".

If this is not the case then check the order of your "allow" directives
in sip0's user entry in sip1's sip.conf file;  Move "ulaw" above "ilbc"
in the allow list.  You should only have "ulaw" listed in the sip1 peer
entry in sip0's sip.conf file.  Why do you have ilbc listed in the sip1
config anyway, if you don't want it to be used?

You may find it preferable to use one codec for the entire path of the
RTP stream, as it'll save transcoding time and possible signal
degradation.

Your scenario is typical of setups that do the following:

    SIP phone  -->  local Asterisk PBX  -->  SIP service provider
    (ulaw)                                   (ilbc, gsm, whatever)

The transcoding definitely works.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/




More information about the asterisk-users mailing list