I’m working on trunking with a provider, with the following requirements:
my end is using Asterisk 16 on Debian
the other end is using Oracle SBC
I must load balance calls between two fixed IP (ie I must alternatively dialout to IP1 and IP2)
I must use the same FQDN in SIP URI, for both fixed IP boxes
provider doesn’t provide any DNS resolution (I must map myself this FQDN to these two fixed IP adresses)
no requirement on fail over (if box with IP1 ever fails, calls should still be sent to IP1)
I was thinking of using a single PJSIP endpoint with a round robin DNS.
What would you suggest ?
How would you implement such round robin DNS ?
The Debian host on which Asterisk is installed is not running any DNS server and I would prefer to keep it not offering any name resolution service to any other box over the network
@PitzKey
If I’m not mistaken, your solution works if Trunk1 and Trunk2 both use IP addresses.
If you are required to use domain names, you must somehow map those domain names to IP addresses.
In my case, both IP addresses must be mapped to the same domain name and I don’t how to alternatively use each IP.
If PJSIP had some sort of Dialing allowing to define, call by call, this domain to IP mapping, that would be perfect.
Alternatively, if I could set in PJSIP aor settings, something:
[foo1]
type=aor
dns_override_domain=example.com
dns_override_ip=1.2.3.4
server_uri=sip:example.com
then, when Asterisk has to send anything to foo1 or foo2, before querying DNS services, it would just resolve any instance of example.com withe either 1.2.3.4 or 1.2.3.5, depending on which contact is dialed to.
I am not sure I am following… You will need one FQDN sip.example.com that has two SRV records, one record for each IP. Once the records are in place, confirm that you actually see them, using dig.
Thinking back to my requirements, I forgot to mention I would appreciate to send OPTIONS to both SBC instances (the one I’m trunking with).
This leads me to configure PJSIP with one single endpoint and two AOR: one per SBC.
This way, Asterisk would continuously send OPTIONS to both instances and I could use PJSIP_CONTACT to select the SBC I would like to send calls to.
With this goal in mind, everything would be OK, if I was not required to use the same foobar.example.com domain name for both AORs as for AOR1, I would like my target foobar.example.com to resolve to IP1 and for AOR2, I would like my target foobar.example.com to resolve to IP2.
If I had a way to tell Asterisk to use a specific resolver for anything related to a specific AOR …
Reading my above message, I would to clarify it a bit further.
The provider I’m trunking wants to receive either on IP1 or IP2, INVITEs with a domain name in Request-URI:
INVITE: sip:411@foobar.example.com;user=phone SIP/2.0
Incoming INVITE with IP address instead of domain name are treated correctly but the provider insists these are not compliant with its rules.
I upgraded to Debian Bookworm’s Asterisk 20 and configured two AORs for the same Endpoint.
How do you dial through a specific AOR then and still use domain name in INVITE Request-URI ?
I used something like but Dial(PJSIP/othertestbed/sip:0123456789@192.168.4.73) but domain is lost in the process.
I’m sure using two endpoints, each with a single AOR would work around the issue but for the sake of completeness, I prefer to ask.
If an endpoint has two AOR, which one will be dialed though PJSIP/0123456789@othertestbed ? Both ? The first one ? A random one (if I could choose, the would be my favorite) ?