Autodomain equivalent in PJSIP

Hi guys,

similar to this topic I’m looking for an option to configure the SRV lookup in PJSIP.
For chan_SIP there is the autodomain option, which defines whether or not an additional lookup with the local domain is done. I’d very much like to set it to “no” in PJSIP, but I’m not able to find a similar configuration option.
PJSIP keeps making nonsensical DNS queries with my local domain appended like sipgate.de.home.lan. and _sips._tcp.sipgate.de.home.lan.

  • sipgate.de being my actual SIP provider domain
  • home.lan being my local LAN domain in which my Asterisk server is in with hostname asterisk.home.lan

Those requests naturally end in NXDOMAIN responses and do no harm, but they are annoying and do spam my DNS server.

Show the config for this trunk. Never seen what you are saying happen unless it was misconfigured.

Sure, no problem. Here’s my redacted pjsip.conf with the internal context stuff removed.

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
local_net = 192.168.0.0/255.255.0.0
local_net = 10.0.0.0/255.0.0.0
local_net = 172.16.0.0/12
tos = cs3

[sipgate_reg]
type = registration
retry_interval = 20
max_retries = 10000
contact_user = ${userId}
expiration = 120
transport = transport-udp
outbound_auth = sipgate_auth_reg
client_uri = sip:${userId}@sipgate.de
server_uri = sip:sipgate.de

[sipgate_auth_reg]
type = auth
username = ${userId}
password = ${password}

[sipgate_aor]
type = aor
contact = sip:${userId}@sipgate.de
default_expiration = 120
qualify_frequency = 67       
qualify_timeout = 3.0        

[sipgate_identify]
type = identify
endpoint = sipgate
match = sipgate.de

[sipgate_auth]
type = auth
auth_type = userpass
username = ${userId}
password = ${password}

[sipgate]
type = endpoint
context = external-incoming-sipgate
dtmf_mode = rfc4733
disallow = all
allow = g722,alaw,ulaw,opus,g729,gsm
rtp_symmetric = no
force_rport = no
rewrite_contact = no
direct_media = no
timers = yes
from_user = ${userId}
from_domain = sipgate.de
tos_audio = ef
tos_video = cs3
language = de
outbound_auth = sipgate_auth
aors = sipgate_aor
media_address = 172.22.22.124
bind_rtp_to_media_address = yes

Please let me know, if there is any other configuration or log you want to see. I appreciate any hints. Thanks!

OK, let’s see logs and output of this appending of your local domain to requests

autodomain in chan_sip doesn’t do that. It’s referring to local known SIP domains, not DNS resolution behavior. Instead the underlying system resolver can, while for PJSIP if the unbound resolver is in use it doesn’t. We actually have a feature request regarding adding support for behaving like this to the unbound one[1].

[1] Add support for ndots to unbound resolver · Issue #37 · asterisk/asterisk-feature-requests · GitHub

Thank you Joshua for your input.
I’m not aware of using the PJSIP resolver. I checked with module show if res_resolver_unbound is loaded, but it is not. I also checked my system for libunbound. It’s not installed. So, I believe my Asterisk is just using the system resolver. The resolv.conf of the system looks kinda simple

search home.lan
nameserver 10.0.11.1
nameserver 2003:d1:8f2a:aaaa:bbbb:cccc:dddd

The nameserver directives contain the IPv4 and IPv6 addresses of my local DNS server. It’s also an Unbound instance, which contains the records of home.lan. and does the actual recursive resolving and caching.
ndots is not set and should default to 1.
So, I’m a bit confused now. The system resolver should only append the search domain, if there are no dots in the name to look up. That is not the case for look-ups of any domain, including sipgate.de. Yet my DNS server log looks like this: