dynamically alter list of offered codecs (for faxing)

Home » Asterisk Users » dynamically alter list of offered codecs (for faxing)
Asterisk Users No Comments

Hello everybody!

Lately I’ve had experiences that I’d like to share with you:

I did a some faxing over VOIP during the last two years. Not that much,
lets say 1 fax per day on average. The setup is

Old analog fax machine < -> Linksys PAP2 ATA < -> Asterisk 1.2 < -> DSL < ->
VoIP Provider ….

I would estimate that 80% of the faxes went through on the first try.
The rest aborted transmission with some communications error and needed
a second (or rarely a 3rd) try.
Then suddenly, faxing didn’t work that way any more. Every single fax
needed many retries until it eventually went through.

Now, since I didn’t change anything on my side I wondered what had
happened. I enabled sip debug on the CLI an made a test fax.
I saw that my VoIP provider only offered codec alaw while the ATA was
configured to only use ulaw.
So I assume that Asterisk had to perform some transcoding and maybe that
broke the reliability … ???
Since I didn’t change anything on my side, the only reason I can think
of ist that my provider changed some hardware or whatever and suddenly
offers only alaw.
I reconfigured the ATA to only offer alaw and now every fax goes through
on the first try without any problems.

Through this experience I had an idea:

The list of preferred codecs is “statically” set up in sip.conf.
Is it possible to modify that list dynamically in the dialplan for the
outbound leg?
What I think of is to force the audio-stream to alaw für fax calls (=
calls to/from a specific extension), but offer for example gsm for
speech calls.

(For example: FAX machine is connected to etension 1234. If a call is
made from extension 1234, Asterisk should offer only alaw to the
_provider_ side)