IVR and transcoding

I’m running a very simple IVR application over SIP on open-source Asterisk I perform an Originate() specifying the “outgoing” extension whereby the script enters a DTMF PIN, then sits in a loop playing a number followed by silence:

exten => outgoing,1,UserEvent(CallPlaced,TestUser: ${participant_number},Channel: ${CHANNEL})
exten => outgoing,2,Wait(3)
exten => outgoing,3,SendDTMF(${participant_pin})
exten => outgoing,4,SendDTMF(#)
exten => outgoing,5,Playback(silence/5)
exten => outgoing,6,SayNumber(${participant_number})
exten => outgoing,7,Goto(5)

I am running this script in two different configurations: one using a G.711 mu-law codec and one using the iLBC codec. I have complete sets of sound files for both G.711 and iLBC. When I run the script using G.711 mu-law I am able to support over 1000 channels. When trying to run with iLBC, I can support less than 200 channels. I added some debug logging to the Asterisk source that indicates translation is occuring on all input and output frames, even though I’ve got sound files in the appropriate format and the correct format files are being played according to Asterisk logging.

Here is my SIP.conf (when configured for iLBC):



All of the Originate() calls are dialing 9999.

Any thoughts on why Asterisk would be transcoding when I wouldn’t think it would need to? Does iLBC always translate because of its internal PLC?

Any help is greatly appreciated…


Found the problem after a lot of poking around in the Asterisk source code!

When an Originate is initiated, by default Asterisk is configured to use AST_FORMAT_SLINEAR internally for channel read data, requiring a translation from iLBC to slin for every frame of RTP data received. It looks like this default behavior can be overridden by specifying a codec (or codecs) in a “Codecs:” header line in Originate. As best I can tell, this header is undocumented. The Manager API I’m using (py-asterisk) to generate these calls doesn’t support setting the “Codecs:” header, so I just hardcoded the default to be AST_FORMAT_ILBC. Voila! No more iLBC->slin translations!

I’m going to re-run my tests tomorrow.