[Asterisk-Users] allowing/disallowing codecs in dialplan?

Andreas Greulich andreas.greulich at spl.ch
Tue Sep 14 23:27:21 MST 2004


Hmm, I think the settings in sip.conf alone are not sufficient for what I look
for. Maybe I should be more precise to explain the problem.

When I make an outgoing call from my GrandStream (GS below) phone, I use a
prefix to differ between server A and server B (both PSTN gateways). A only
supports ULAW, B only supports iLBC (to make it easier :-). The diagram below
shows 2 outgoing calls, one to A, and one to B. For each there's the line in the
config files mentioned:
              

   sip.conf:
    [GS]
    allow=ilbc ; cannot differ between server A
    allow=ulaw ; and server B here            <ULAW>
   extensions.conf:               +-----------------------------> Server A   
    exten => _1.,2,Dial(.. at A,60,) | sip.conf: [A]
   ------------------------->-+---+           disallow=ilbc
         <ULAW> ???           |   |           allow=ulaw
GS                            | * |
         <iLBC> ???           |   |
   ------------------------->-+---+
   extensions.conf:               |           <iLBC>
    exten => _2.,2,Dial(.. at A,60,) +-----------------------------> Server B
                                   sip.conf: [B]
                                             disallow=ulaw
                                             allow=ilbc

In sip.conf, I can only influence the righthandside negotiation. The
lefthandside negotiation between GS and * is only influenced by the [GS] section
of sip.conf, but of course the same for each outgoing call and will, say, always
chose ilbc. I miss the possibility that asterisk can negotiate with GS the ulaw
codec if GS dials a _1. number, and the ilbc codec if the GS dials a _2. number.
These difference could only be made in extensions.conf (dialplan), as they both
refer to the same section in sip.conf.

Now I'm aware that, technically, * probably already negotiated the codec with GS
when it starts matchinf the dialplan patterns. But on the other hand, all needed
information (number the device wants to dial) should already be present in the
initial INVITE message from GS... so I wonder if there's any way to influence
the codec negotiation depending on headers present in the initial SIP INVITE
message? Maybe this would require some code change, which would also be ok for me. 

Am I really the only person who wants to do something like above scenario and
avoid codec translation...???

Note that, of course, the same problem happens on incoming calls:




   sip.conf:
    [GS]
    allow=ilbc ; cannot differ between server A
    allow=ulaw ; and server B here            <ULAW>
   extensions.conf:               +-<--------------------------- Server A   
    exten => A,2,Dial(.. at GS,60, ) | sip.conf: [A]
   <--------------------------+---+           disallow=ilbc
         <ULAW> ???           |   |           allow=ulaw
GS                            | * |
         <iLBC> ???           |   |
   <--------------------------+---+
   extensions.conf:               |           <iLBC>
    exten => B,2,Dial(.. at GS,60,)  +-<--------------------------- Server B
                                   sip.conf: [B]
                                             disallow=ulaw
                                             allow=ilbc




----- Original Message ----- "Kannaiyan Natesan" <nkans at speak2world.com>

You said what is possible and in exists.
Can you try with the settings what you have mentioned.


-Kannaiyan

----- Original Message ----- From: "Andreas Greulich" <andreas.greulich at spl.ch>
To: "Asterisk-Users" <asterisk-users at lists.digium.com>
Cc: "Greulich, Andreas" <dust at triton.ch>
Sent: Monday, September 13, 2004 8:35 PM
Subject: [Asterisk-Users] allowing/disallowing codecs in dialplan?


Hi all,

Is there a possibility to set the codecs Asterisk will choose in the dialplan
("exten=>" statements or their contexts) instead of sip.conf?

My problem is that I connect my SIP phone with several providers (Nikotel,
Sipgate, Stanaphone) for icoming and outgoing calls. Not all of these providers
offer the same set of codecs. I'd like Asterisk to use the same codec for the
provider side as well as of the device side, to prevent codec translation.
Unfortunately, Asterisk seems to negotiate the codec for the device and for the
peer independently, so it often happens it sets them differently.
...




More information about the asterisk-users mailing list