Ok - My carrier has two ports available for registration - 5060 and 7000 - If I specify the port, SRV lookup fails miserably and the trunk never even tries to register - If I remove the port and let it try (and register on 5060) it works fine - The SRV lookup happens just like it does with CHAN SIP and away you go - Why would it be this way?
Specifying the port on CHAN SIP does not mess with the SRV lookup.
If the TARGET was not a numeric IP address, but a port is present in
the URI, the client performs an A or AAAA record lookup of the domain
name.
The resolver follows that. This is because SRV records contain the port to use, so overriding it goes against the actual configured DNS of whatever is being resolved.
Does the A or AAAA lookup contain the port? I am looking at the Packet Captures I used to figure out what it was doing and I didn’t see a port in the response back on the DNS queries - Just the hostnames.
Answer my own question - yes it does:
_sip._udp.somewhere.net: type SRV, class IN, priority 30, weight 50, port 7000, target somewhere-else.net
That is an SRV record from Flowroute, and they specify a port of 5060. Once this record is retrieved the resolver then performs an A and AAAA lookup to get the IP address to contact.
If you have a static IP address and your provider supports IP authentication, you probably should not be using registration. Set Match (Permit) to allow calls from any of their addresses. If their system is reasonable, when they get no response to a call sent from one address, they will resend it from another.
For outgoing, your setup should be based on what failover options you have. If you don’t have a reliable fully functional failover, IMO you should set up two or more trunks that send to different addresses at the provider. This avoids issues where a missed qualify response causes a call to fail, even though a subsequent SRV lookup would yield a working server address.