Asterisk PJSIP identify match host with multiple A records

Hello,
I connected my PBX to a SIP server with host name ipx.mixvoip.com that have multiple A records:

# dig A ipx.mixvoip.com

; <<>> DiG 9.9.4-RedHat-9.9.4-74.el7_6.1 <<>> A ipx.mixvoip.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34145
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;ipx.mixvoip.com.               IN      A

;; ANSWER SECTION:
ipx.mixvoip.com.        29      IN      A       185.125.183.7
ipx.mixvoip.com.        29      IN      A       185.125.183.11
ipx.mixvoip.com.        29      IN      A       185.125.183.21
ipx.mixvoip.com.        29      IN      A       185.125.183.3
ipx.mixvoip.com.        29      IN      A       185.125.183.4
ipx.mixvoip.com.        29      IN      A       185.125.183.16
ipx.mixvoip.com.        29      IN      A       185.125.183.22

I got inbound call that got rejected with reason No matching endpoint found.
Then i checked what is going on and noticed my asterisk 13.27.1 is not adding all IP addresses to the Identify-Match but only the first 5 IP addresses:

voip*CLI> pjsip show identify mixvoip

 Identify:  <Identify/Endpoint...........................................................>
      Match:  <criteria...........................>
==========================================================================================

 Identify:  mixvoip/mixvoip
      Match: 185.125.183.7/32
      Match: 185.125.183.11/32
      Match: 185.125.183.21/32
      Match: 185.125.183.3/32
      Match: 185.125.183.4/32


 ParameterName : ParameterValue
 ==============================================
 endpoint      : mixvoip
 match         : 185.125.183.7/255.255.255.255
 match         : 185.125.183.11/255.255.255.255
 match         : 185.125.183.21/255.255.255.255
 match         : 185.125.183.3/255.255.255.255
 match         : 185.125.183.4/255.255.255.255
 match_header  :
 srv_lookups   : true

Why is it not adding all the IP addresses assigned to the host name?
Is there a limit of 5 ip addresses?

Debug level 5 shows only 5 IP addresses processed:

[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting 'ipx.mixvoip.com' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host 'ipx.mixvoip.com' and port ''.
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '7.ipx.mixvoip.com' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '7.ipx.mixvoip.com' and port ''.
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '185.125.183.7' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '185.125.183.7' and port ''.
[2019-10-01 15:10:04] DEBUG[717] acl.c: 185.125.183.7:0/255.255.255.255:0 sense 0 appended to ACL
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '11.ipx.mixvoip.com' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '11.ipx.mixvoip.com' and port ''.
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '185.125.183.11' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '185.125.183.11' and port ''.
[2019-10-01 15:10:04] DEBUG[717] acl.c: 185.125.183.11:0/255.255.255.255:0 sense 0 appended to ACL
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '21.ipx.mixvoip.com' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '21.ipx.mixvoip.com' and port ''.
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '185.125.183.21' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '185.125.183.21' and port ''.
[2019-10-01 15:10:04] DEBUG[717] acl.c: 185.125.183.21:0/255.255.255.255:0 sense 0 appended to ACL
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '3.ipx.mixvoip.com' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '3.ipx.mixvoip.com' and port ''.
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '185.125.183.3' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '185.125.183.3' and port ''.
[2019-10-01 15:10:04] DEBUG[717] acl.c: 185.125.183.3:0/255.255.255.255:0 sense 0 appended to ACL
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '4.ipx.mixvoip.com' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '4.ipx.mixvoip.com' and port ''.
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: Splitting '185.125.183.4' into...
[2019-10-01 15:10:04] DEBUG[717] netsock2.c: ...host '185.125.183.4' and port ''.
[2019-10-01 15:10:04] DEBUG[717] acl.c: 185.125.183.4:0/255.255.255.255:0 sense 0 appended to ACL
[2019-10-01 15:10:04] ERROR[717] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'
[2019-10-01 15:10:04] DEBUG[717] config.c: Parsing /etc/asterisk/pjsip.conf
[2019-10-01 15:10:04] DEBUG[717] config.c: Parsing /etc/asterisk/pjsip_custom.conf
[2019-10-01 15:10:04] DEBUG[717] config.c: Parsing /etc/asterisk/pjsip.transports.conf

It’s preferring the SRV records which seems to only return 5 records:

;; ANSWER SECTION:
_sip._udp.ipx.mixvoip.com. 30	IN	SRV	1 1 5060 3.ipx.mixvoip.com.
_sip._udp.ipx.mixvoip.com. 30	IN	SRV	1 1 5060 16.ipx.mixvoip.com.
_sip._udp.ipx.mixvoip.com. 30	IN	SRV	1 1 5060 4.ipx.mixvoip.com.
_sip._udp.ipx.mixvoip.com. 30	IN	SRV	1 1 5060 22.ipx.mixvoip.com.
_sip._udp.ipx.mixvoip.com. 30	IN	SRV	1 1 5060 11.ipx.mixvoip.com.

If you set “srv_lookups” to “no” it will perform strictly A record lookups instead which will get all the IPs.

1 Like

Total hit. Very fast response, thank you!