I’m trying to force any calls coming from/to an extension to use only the ulaw codec.
This extension (Cisco SPA122 used as an ATA for a fax) is configured to only use ulaw. I’ve verified with a packet capture that it’s only sending PCMU/8000 in it’s INVITE to asterisk.
The extension has:
disallow=all
allow=ulaw
And the outgoing SIP trunk has
disallow=all
allow=g722,g729,ulaw
set in pjsip.endpoint.conf.
When Asterisk sends the INVITE to the SIP trunk, it includes G722 and G729 in the SDP offer (as well as PCMU). The trunk seems to always negotiate to G729, so Asterisk ends up transcoding the ulaw to G729 between the two, and faxes have lots of issues.
I know I can just set the SIP trunk to only allow ulaw, and everything works properly, but I’d like to have
have my normal extensions use G729. I can’t find a way to stop Asterisk from offering the disallowed codecs.
What version of Asterisk? I should also add, it’s not offering disallowed codecs. It’s offering what is configured. You just want the incoming call leg to influence the outgoing call leg.
I’m running Asterisk 16.19.0, on FreePBX 15.0.17.43.
I did see this page that lists some options in Asterisk 18 that might help. However, I figure surely this problem is solvable with some sort of configuration, as I can’t be the only one who as come across this issue before. A few hours of googling didn’t find it for me though…
Does it offer PCMU first? If it does, your real problem is that the other side considers it more important to use G.729 than the caller’s preferred codec
Thanks for your help. I think the PJSIP_MEDIA_OFFER is probably the solution to this problem as written, though I’m not sure how easy it would be to inject that into FreePBX’s autogenerated configuration.
Ultimately though, this “problem” came down to a false assumption I had: that G729 is a better sounding codec than G711/ulaw. I think I mixed up G729 and G722 in that regard.
It appears that our SIP trunk only supports G729 and G711/ulaw, and since I don’t care about bandwidth but do care about faxes working and better quality audio, I just set the only allowed codec on the trunk to be ulaw.
Also, to answer @david551’s question, it was offering G729 first, as that was the first codec on the SIP trunk.