IAX and Realtime

I’m trying to configure IAX for Asterisk Realtime, with MySQL ODBC.


enabled => yes
dsn => MySQL-asterisk
pre-connect => yes


iaxusers => odbc,asterisk_mysql,iaxpeer
iaxpeers => odbc,asterisk_mysql,iaxpeer

Asterisk can connect to the database and retrieve data.

voip*CLI> realtime load iaxpeers name b2g
                   Column Name  Column Value
          --------------------  --------------------
                          name  b2g
                          type  friend
                        secret  AI8an281sk1
                    notransfer  yes
                          auth  md5
                       context  b2g
                          host  dynamic
                        permit  139.***.***.***
                       qualify  1000
                      disallow  all
                         allow  g726
                         allow  alaw
                         allow  gsm
                         allow  ilbc
                        ipaddr  139.***.***.***
                          port  4569
                    regseconds  0

voip*CLI> realtime load extensions context b2g
                   Column Name  Column Value
          --------------------  --------------------
                            id  1
                       context  b2g
                         exten  _X.
                      priority  1
                           app  Dial
                       appdata  Zap/g1/${EXTEN:0}
                   sippeername  gnTel

When i start a SIP call that must be forwarded to the IAX trunk, the following is shown in the Asterisk debug console and i can’t start the call.

Sep 27 08:32:42 NOTICE[10678]: chan_iax2.c:6902 socket_read: Rejected connect attempt from 139..., who was trying to reach '070******@’

If I configure exactly the same in static configuration, it works good.
Maybe, Asterisk Realtime can’t query the database correctly?

I have found this bug report, but that is from more than 1.5 years ago.