Only in very unusual circumstances would you use a compression codec in an FXO gateway.
Your gateway seems local as it’s on a private IP address. If that’s the case, both gateway and trunk settings should enable only ulaw. If it is e.g. connected via a VPN in a location where bandwidth is very limited or expensive, please provide details.
Regarding the other issue, the incoming call is not matching any trunk. Using pjsip or chan_sip? Using registration or statically configured?
I was able to change the Sip Settings to allow “Anonymous Sip Inbound Calls”, and was able to dial in fine, but for a more permanent fix I would like to get away from this, as I feel it leaves too many doors open for security risks.
I know little about Vega but understand that a given FXS or FXO port can be configured to use a different subset of the enabled codecs, via the config file. I don’t know whether this is exposed in the web interface. The entry ‘g7231’ is a flavor of G.723 that is causing your trouble.
The Vega will always use the same codec for transmit and receive, so try enabling only ulaw in the trunk. If this causes calls to be completely rejected, try setting priority 4 to g711Ulaw64k. If still no luck, at the Asterisk command prompt, type sip set debug on
make a failing call and you’ll see the SIP trace (along with the regular entries) in the Asterisk log. The incoming INVITE will show you which codecs are being offered and you can try to adjust the Vega settings to make ulaw first.
In addition to the security issue, if a call doesn’t match a trunk the codec selection is determined by the Audio Codecs section of Asterisk SIP Settings. You could try setting that to ulaw only.
I don’t know how, but if you can get the Vega to send FXO calls from a different local SIP port, then you configure port=xxxx in your trunk settings and the FXO calls should be recognized as belonging to that trunk. OR, if you can get the Vega to send FXO calls to a different port on the PBX, you could set up a pjsip trunk for FXO.