Andreas Greulich
2004-Sep-13 12:35 UTC
[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. I could of course just allow ulaw, bit I'd like to use ilbc where possible (less dropouts). So, I'd like to configure Asterisk in a way that, depending on what extension is chosen, it negotiates another codec with the phone. Of course I considered setting the allow statements in the sections of sip.conf. But it seems these settings are only considered on incoming calls, but not on outgoing calls (initiated by a Dial application with the sip.conf section as its argument). So, when I have something like [general] disallow=all allow=alaw allow=ulaw allow=ilbc [SipgateAccount] type=friend ... disallow=all allow=ilbc then these settings are only considered when I get an incoming call, but not when I make an outgoing call using "exten=>...,Dial/SIP/${EXTEN}@SipgateAccount,60,)" Thanks in advance, Andy -- Andreas Greulich E-Mail: andreas.greulich@spl.ch Skype: klaymen-neverhood Sermo datur cunctis, animi sapientia paucis.
Kannaiyan Natesan
2004-Sep-13 12:42 UTC
[Asterisk-Users] allowing/disallowing codecs in dialplan?
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@spl.ch> To: "Asterisk-Users" <asterisk-users@lists.digium.com> Cc: "Greulich, Andreas" <dust@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. I could of course just allow ulaw, bit I'd like to use ilbc where possible (less dropouts). So, I'd like to configure Asterisk in a way that, depending on what extension is chosen, it negotiates another codec with the phone. Of course I considered setting the allow statements in the sections of sip.conf. But it seems these settings are only considered on incoming calls, but not on outgoing calls (initiated by a Dial application with the sip.conf section as its argument). So, when I have something like [general] disallow=all allow=alaw allow=ulaw allow=ilbc [SipgateAccount] type=friend ... disallow=all allow=ilbc then these settings are only considered when I get an incoming call, but not when I make an outgoing call using "exten=>...,Dial/SIP/${EXTEN}@SipgateAccount,60,)" Thanks in advance, Andy -- Andreas Greulich E-Mail: andreas.greulich@spl.ch Skype: klaymen-neverhood Sermo datur cunctis, animi sapientia paucis. _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Andreas Greulich
2004-Sep-14 23:27 UTC
[Asterisk-Users] allowing/disallowing codecs in dialplan?
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(..@A,60,) | sip.conf: [A] ------------------------->-+---+ disallow=ilbc <ULAW> ??? | | allow=ulaw GS | * | <iLBC> ??? | | ------------------------->-+---+ extensions.conf: | <iLBC> exten => _2.,2,Dial(..@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(..@GS,60, ) | sip.conf: [A] <--------------------------+---+ disallow=ilbc <ULAW> ??? | | allow=ulaw GS | * | <iLBC> ??? | | <--------------------------+---+ extensions.conf: | <iLBC> exten => B,2,Dial(..@GS,60,) +-<--------------------------- Server B sip.conf: [B] disallow=ulaw allow=ilbc ----- Original Message ----- "Kannaiyan Natesan" <nkans@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@spl.ch> To: "Asterisk-Users" <asterisk-users@lists.digium.com> Cc: "Greulich, Andreas" <dust@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. ...