[Asterisk-Dev] Request for feedback: Overriding codec in dialplan

Michael Giagnocavo mgg-digium at atrevido.net
Fri Jan 14 21:50:50 MST 2005


Hello,

	I just wrote the first bit of code to change preferences in the
dialplan. What I didn't realize is that Asterisk as a server is going to
override the preferred codec. So just sending your preferred codec won't
guarantee anything. Thus, the only way to "override", or "force" your
preferred codec is to set your capabilities to just the codec you want to
use.

	Sure, it's 'mean', but it's the only way. Currently, the only other
way to do this is to declare a separate peer, allowing only the codec you
want. Here's three use cases:

	1. A user wants to specify a codec to reduce transcoding. I've got a
few phones connected to me, some ULAW, some G729. My termination provider
provides transcoding for me, so it's more efficient for me to send G729
calls as G729, and ULAW calls as ULAW. Just setting preference won't
guarantee (esp. since G729 is biased against :)).

	2. A user wants to save bandwidth on non-local calls. This was
posted to the -users list not too long ago. Phones A and B are on a LAN, and
Phones C and D, on another. Calls on the LAN should be ULAW, while calls
going across the Internet should be compressed. 

	3. Controlling quality on-the-fly. For example, I've heard of people
not wanting to use ULAW when dialing a cell phone, instead preferring GSM.

	A sample would be (assuming allow=all):

	exten => 1,1,SetVar(_CODEC_OVERRIDE=lpc10)
	exten => 1,2,Dial(IAX/foo/123)

	If you'd like this functionality, please speak up. If you don't, and
have a real reason why this would degrade the overall Asterisk experience,
please speak up.

Thank you,
Michael





More information about the asterisk-dev mailing list