User registration problem etsock2.c:263 ast_sockaddr_resolve

Hello
I have user registration problem.
From some networks when user make registration request it’s incomplite.
There is error:
– Registered SIP ‘301’ at 212.93.105.111:3678
[Mar 12 00:52:05] ERROR[5048]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“212.93.105.111:3678”, “3678”, …): No address associated with hostname
[Mar 12 00:52:05] ERROR[5048]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“212.93.105.111:3678”, “3678”, …): No address associated with hostname
As i understand ast_sockaddr_resolve() used for resolving hostnames.
But as seen on log messages it isn’t host name there are clear ip address, and host lookup not needed.
Why asterisk try to lookup?

How to solve this problem ?

212.93.105.111:3678 is not a valid IP address. You need to provide the actual SIP packet to distinguish between an error in the sender (e.g. 212.93.105.111:3678:3678) or a failure of Asterisk to correctly parse addresses with explicit port numbers.

Which version of Asterisk are you using. Does this happen with the most recent 1.8.x or 10.x release versions?

I was try asterisk 1.8.5, 1.8.10, 10.2.0
Same problem on all systems.
tcpdump below:
Please help me solve this problem

tcpdump -evv net 212.93.105.98
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
23:24:22.386888 00:50:56:9d:05:03 (oui Unknown) > 00:50:56:9d:1d:18 (oui Unknown), ethertype IPv4 (0x0800), length 617: (tos 0x0, ttl 55, id 0, offset 0, flags [DF], proto UDP (17), length 603)
212.93.105.98.15669 > 195.245.194.102.sip: [udp sum ok] SIP, length: 575
REGISTER sip:195.245.194.102 SIP/2.0
Via: SIP/2.0/UDP 212.93.105.98:15669;rport;branch=z9hG4bKPjnqDOplIsgbBTzFvsXkFzhJ1g8CbakQd9
Route: sip:195.245.194.102;transport=udp;lr
Max-Forwards: 70
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25300 REGISTER
User-Agent: CSipSimple r1108 / marvel-10
Contact: sip:302@212.93.105.98:15669;ob
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0

23:24:22.387323 00:50:56:9d:1d:18 (oui Unknown) > 00:50:56:9d:05:03 (oui Unknown), ethertype IPv4 (0x0800), length 608: (tos 0x0, ttl 64, id 30143, offset 0, flags [none], proto UDP (17), length 594)
195.245.194.102.sip > 212.93.105.98.15669: [bad udp cksum 52f7!] SIP, length: 566
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 212.93.105.98:15669;branch=z9hG4bKPjnqDOplIsgbBTzFvsXkFzhJ1g8CbakQd9;received=212.93.105.98;rport=15669
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102;tag=as0aaeda18
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25300 REGISTER
Server: Asterisk PBX 10.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="0689bbfa"
Content-Length: 0

23:24:22.708190 00:50:56:9d:05:03 (oui Unknown) > 00:50:56:9d:1d:18 (oui Unknown), ethertype IPv4 (0x0800), length 617: (tos 0x0, ttl 55, id 0, offset 0, flags [DF], proto UDP (17), length 603)
212.93.105.98.15669 > 195.245.194.102.sip: [udp sum ok] SIP, length: 575
REGISTER sip:195.245.194.102 SIP/2.0
Via: SIP/2.0/UDP 212.93.105.98:15669;rport;branch=z9hG4bKPjnqDOplIsgbBTzFvsXkFzhJ1g8CbakQd9
Route: sip:195.245.194.102;transport=udp;lr
Max-Forwards: 70
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25300 REGISTER
User-Agent: CSipSimple r1108 / marvel-10
Contact: sip:302@212.93.105.98:15669;ob
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0

23:24:22.708407 00:50:56:9d:1d:18 (oui Unknown) > 00:50:56:9d:05:03 (oui Unknown), ethertype IPv4 (0x0800), length 608: (tos 0x0, ttl 64, id 30144, offset 0, flags [none], proto UDP (17), length 594)
195.245.194.102.sip > 212.93.105.98.15669: [bad udp cksum 52f7!] SIP, length: 566
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 212.93.105.98:15669;branch=z9hG4bKPjnqDOplIsgbBTzFvsXkFzhJ1g8CbakQd9;received=212.93.105.98;rport=15669
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102;tag=as0aaeda18
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25300 REGISTER
Server: Asterisk PBX 10.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="0689bbfa"
Content-Length: 0

23:24:23.171909 00:50:56:9d:05:03 (oui Unknown) > 00:50:56:9d:1d:18 (oui Unknown), ethertype IPv4 (0x0800), length 778: (tos 0x0, ttl 55, id 0, offset 0, flags [DF], proto UDP (17), length 764)
212.93.105.98.15669 > 195.245.194.102.sip: [udp sum ok] SIP, length: 736
REGISTER sip:195.245.194.102 SIP/2.0
Via: SIP/2.0/UDP 212.93.105.98:15669;rport;branch=z9hG4bKPjMXm1EuwqJvrQw90Vx7Dsf6Rg4zQlFJBT
Route: sip:195.245.194.102;transport=udp;lr
Max-Forwards: 70
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25301 REGISTER
User-Agent: CSipSimple r1108 / marvel-10
Contact: sip:302@212.93.105.98:15669;ob
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username=“302”, realm=“asterisk”, nonce=“0689bbfa”, uri=“sip:195.245.194.102”, response=“68cdc1977b722b69f24aa1c3bc2dee43”, algorithm=MD5
Content-Length: 0

23:24:23.172406 00:50:56:9d:1d:18 (oui Unknown) > 00:50:56:9d:05:03 (oui Unknown), ethertype IPv4 (0x0800), length 628: (tos 0x0, ttl 64, id 30145, offset 0, flags [none], proto UDP (17), length 614)
195.245.194.102.sip > 212.93.105.98.15669: [bad udp cksum b001!] SIP, length: 586
SIP/2.0 200 OK
Via: SIP/2.0/UDP 212.93.105.98:15669;branch=z9hG4bKPjMXm1EuwqJvrQw90Vx7Dsf6Rg4zQlFJBT;received=212.93.105.98;rport=15669
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102;tag=as0aaeda18
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25301 REGISTER
Server: Asterisk PBX 10.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 900
Contact: sip:302@212.93.105.98:15669;ob;expires=900
Date: Mon, 12 Mar 2012 21:24:23 GMT
Content-Length: 0

23:24:23.506232 00:50:56:9d:05:03 (oui Unknown) > 00:50:56:9d:1d:18 (oui Unknown), ethertype IPv4 (0x0800), length 778: (tos 0x0, ttl 55, id 0, offset 0, flags [DF], proto UDP (17), length 764)
212.93.105.98.15669 > 195.245.194.102.sip: [udp sum ok] SIP, length: 736
REGISTER sip:195.245.194.102 SIP/2.0
Via: SIP/2.0/UDP 212.93.105.98:15669;rport;branch=z9hG4bKPjMXm1EuwqJvrQw90Vx7Dsf6Rg4zQlFJBT
Route: sip:195.245.194.102;transport=udp;lr
Max-Forwards: 70
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25301 REGISTER
User-Agent: CSipSimple r1108 / marvel-10
Contact: sip:302@212.93.105.98:15669;ob
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username=“302”, realm=“asterisk”, nonce=“0689bbfa”, uri=“sip:195.245.194.102”, response=“68cdc1977b722b69f24aa1c3bc2dee43”, algorithm=MD5
Content-Length: 0

23:24:23.506492 00:50:56:9d:1d:18 (oui Unknown) > 00:50:56:9d:05:03 (oui Unknown), ethertype IPv4 (0x0800), length 620: (tos 0x0, ttl 64, id 30146, offset 0, flags [none], proto UDP (17), length 606)
195.245.194.102.sip > 212.93.105.98.15669: [bad udp cksum 265a!] SIP, length: 578
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 212.93.105.98:15669;branch=z9hG4bKPjMXm1EuwqJvrQw90Vx7Dsf6Rg4zQlFJBT;received=212.93.105.98;rport=15669
From: sip:302@195.245.194.102;tag=CwHbO0ygKUaNbCy1gRypc7sGMh4IC.Ck
To: sip:302@195.245.194.102;tag=as0aaeda18
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25301 REGISTER
Server: Asterisk PBX 10.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“1f363fb2”, stale=true
Content-Length: 0

23:24:23.907452 00:50:56:9d:05:03 (oui Unknown) > 00:50:56:9d:1d:18 (oui Unknown), ethertype IPv4 (0x0800), length 796: (tos 0x0, ttl 55, id 0, offset 0, flags [DF], proto UDP (17), length 782)
212.93.105.98.15669 > 195.245.194.102.sip: [udp sum ok] SIP, length: 754
REGISTER sip:195.245.194.102 SIP/2.0
Via: SIP/2.0/UDP [212.93.105.98:15669]:15669;rport;branch=z9hG4bKPjoKE4spsNkz0I3E7EViRzteCGTrpZclU2
Route: sip:195.245.194.102;transport=udp;lr
Max-Forwards: 70
From: sip:302@195.245.194.102;tag=lowoWUT.isnYQQwMv8RTd9tbjGoSzMgG
To: sip:302@195.245.194.102
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25302 REGISTER
Authorization: Digest username=“302”, realm=“asterisk”, nonce=“0689bbfa”, uri=“sip:195.245.194.102”, response=“68cdc1977b722b69f24aa1c3bc2dee43”, algorithm=MD5
User-Agent: CSipSimple r1108 / marvel-10
Contact: sip:302@212.93.105.98:15669;ob;expires=0
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0

23:24:24.344910 00:50:56:9d:05:03 (oui Unknown) > 00:50:56:9d:1d:18 (oui Unknown), ethertype IPv4 (0x0800), length 796: (tos 0x0, ttl 55, id 0, offset 0, flags [DF], proto UDP (17), length 782)
212.93.105.98.15669 > 195.245.194.102.sip: [udp sum ok] SIP, length: 754
REGISTER sip:195.245.194.102 SIP/2.0
Via: SIP/2.0/UDP [212.93.105.98:15669]:15669;rport;branch=z9hG4bKPjoKE4spsNkz0I3E7EViRzteCGTrpZclU2
Route: sip:195.245.194.102;transport=udp;lr
Max-Forwards: 70
From: sip:302@195.245.194.102;tag=lowoWUT.isnYQQwMv8RTd9tbjGoSzMgG
To: sip:302@195.245.194.102
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25302 REGISTER
Authorization: Digest username=“302”, realm=“asterisk”, nonce=“0689bbfa”, uri=“sip:195.245.194.102”, response=“68cdc1977b722b69f24aa1c3bc2dee43”, algorithm=MD5
User-Agent: CSipSimple r1108 / marvel-10
Contact: sip:302@212.93.105.98:15669;ob;expires=0
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0

23:24:24.345143 00:50:56:9d:1d:18 (oui Unknown) > 00:50:56:9d:05:03 (oui Unknown), ethertype IPv4 (0x0800), length 628: (tos 0x0, ttl 64, id 30148, offset 0, flags [none], proto UDP (17), length 614)
195.245.194.102.sip > 212.93.105.98.15669: [bad udp cksum afa5!] SIP, length: 586
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP [212.93.105.98:15669]:15669;branch=z9hG4bKPjoKE4spsNkz0I3E7EViRzteCGTrpZclU2;received=212.93.105.98;rport=15669
From: sip:302@195.245.194.102;tag=lowoWUT.isnYQQwMv8RTd9tbjGoSzMgG
To: sip:302@195.245.194.102;tag=as0aaeda18
Call-ID: Eh1bef1fCzbMzexPEXSDvHAYZztLJNIm
CSeq: 25302 REGISTER
Server: Asterisk PBX 10.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“1f363fb2”, stale=true
Content-Length: 0

The problem address doesn’t appear in the SIP trace.

With this IP is the same problem (IP is dynamic)
– Registered SIP ‘302’ at 212.93.105.98:15669
[Mar 12 23:24:23] ERROR[5048]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“212.93.105.98:15669”, “15669”, …): No address associated with hostname
[Mar 12 23:24:24] ERROR[5048]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“212.93.105.98:15669”, “15669”, …): No address associated with hostname
[Mar 12 23:24:24] ERROR[5048]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“212.93.105.98:15669”, “15669”, …): No address associated with hostname
[Mar 12 23:24:25] ERROR[5048]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo(“212.93.105.98:15669”, “15669”, …): No address associated with hostname

That’s error was when i got tcpdump

For test i’m install asterisk 1.6.0
and when try to register i see:
– Registered SIP ‘302’ at 212.93.105.67 port 5786
[Mar 13 02:47:59] WARNING[9006]: chan_sip.c:12422 check_via: ‘[212.93.105.67’ is not a valid host
[Mar 13 02:48:00] WARNING[9006]: chan_sip.c:12422 check_via: ‘[212.93.105.67’ is not a valid host
[Mar 13 02:48:00] WARNING[9006]: chan_sip.c:12422 check_via: ‘[212.93.105.67’ is not a valid host
[Mar 13 02:48:00] WARNING[9006]: chan_sip.c:12422 check_via: ‘[212.93.105.67’ is not a valid host

why “[” symbol could be in ip address ?
also this problem is only with one mobile operator.
when using wifi or other operator no such problem.
Please help me to solve this problem.

The problem is the Via: header sent by CSipSimple:

you could try fixing CSipSimple settings or tell asterisk to ignore it via nat=yes setting for this peer.

In my sip.conf ich and user peer have nat=yes setting this too.
but problem is:(
which settings could i set on csipsample to void this problem ?
or may be i could make fix in aster code to remove bad chars from ip address ?