Realtime sip - problem with incoming calls

Hello.!

We have a problem with incoming calls from sip provider to asterisk when configuring sip channels using realtime. When asterisk receive call, we see a message in logs:

NOTICE[19805]: chansip.c:21250 handlerequest_invite: Sending fake auth rejection for device “test” sip:test@my.sip-provider.org;tag=as0af02b0c.

It happens when parameter host is a domain name of sip provider (sipnet.ru for example). If we put IP address there, everything works fine.

If we setup sip channels using sip.conf file, everything works fine even if value of host parameter is domain name.

For sip trunk insecure=invite. DNS works fine on that machine.

Here is log of sql queries

SELECT * FROM peer WHERE name = ‘user_id’

SELECT * FROM peer WHERE name = ‘user_id’ AND host = ‘dynamic’

SELECT * FROM peer WHERE name = ‘user_id’

SELECT * FROM peer WHERE host = ‘AAA.BBB.CCC.DDD’ AND port = ‘5060’

SELECT * FROM peer WHERE ipaddr = ‘AAA.BBB.CCC.DDD’ AND port = ‘5060’

SELECT * FROM peer WHERE host = ‘AAA.BBB.CCC.DDD’ ORDER BY host

SELECT * FROM peer WHERE ipaddr = ‘AAA.BBB.CCC.DDD’ ORDER BY ipaddr

, where

user_id - caller id

AAA.BBB.CCC.DDD - ip address of sip provider’s server

As you can see, asterisk doesn’t try to search channel by hostname.

It seems, asterisk use different logic when using sip peers from realtime and config files. Or we are wrong somewhere?