IAX2 Peers in Realtime get overlapped

Hi,

If I do the config of peers on iax.conf all works fine.

But when I change to realtime and threre are 2 concurrent registers, first iaxpeer port is used on the second iaxpeer register.

example: peer 8007 is registered on port 4573 instead 4578:

chan_iax2.c: Found peer. What’s device state of 8003? addr=127.0.0.1:4573, defaddr=127.0.0.1:4573 maxms=2000, lastms=1
chan_iax2.c: Found peer. What’s device state of 8007? addr=127.0.0.1:4577, defaddr=127.0.0.1:4577 maxms=2000, lastms=3
res_odbc.c: Reusing ODBC handle 0x320e8f8 from class ‘asterisk’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Skip: 0; SQL: UPDATE iaxpeers SET ipaddr=?, regseconds=?, port=? WHERE name=?
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 1 (‘ipaddr’) = ‘127.0.0.1’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 2 (‘regseconds’) = ‘1509890002’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 3 (‘port’) = ‘4573’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 4 = ‘8007’

Can anyone help me? I try with res_odbc and res_mysql with the same behavior.

Regards,


Full log:

[Nov 5 14:53:22] DEBUG[10687] devicestate.c: No provider found, checking channel drivers for IAX2 - 8008
[Nov 5 14:53:22] DEBUG[10687] chan_iax2.c: Checking device state for device 8008
[Nov 5 14:53:22] DEBUG[10687] chan_iax2.c: Found peer. What’s device state of 8008? addr=127.0.0.1:4578, defaddr=127.0.0.1:4578 maxms=2000, lastms=3
[Nov 5 14:53:22] DEBUG[10687] devicestate.c: Changing state for IAX2/8008 - state 0 (Unknown)
[Nov 5 14:53:22] DEBUG[10704] chan_iax2.c: Determining if address 127.0.0.1 with username 8003 requires calltoken validation. Optional = 0 calltoken_required = 3
[Nov 5 14:53:22] DEBUG[10704] chan_iax2.c: ip callno count incremented to 22 for 127.0.0.1
[Nov 5 14:53:22] DEBUG[10687] devicestate.c: No provider found, checking channel drivers for IAX2 - 8003
[Nov 5 14:53:22] DEBUG[10687] chan_iax2.c: Checking device state for device 8003
[Nov 5 14:53:22] DEBUG[10687] chan_iax2.c: Found peer. What’s device state of 8003? addr=127.0.0.1:4573, defaddr=127.0.0.1:4573 maxms=2000, lastms=1
[Nov 5 14:53:22] DEBUG[10687] devicestate.c: Changing state for IAX2/8003 - state 0 (Unknown)
[Nov 5 14:53:22] DEBUG[10687] devicestate.c: No provider found, checking channel drivers for IAX2 - 8007
[Nov 5 14:53:22] DEBUG[10687] chan_iax2.c: Checking device state for device 8007
[Nov 5 14:53:22] DEBUG[10687] chan_iax2.c: Found peer. What’s device state of 8007? addr=127.0.0.1:4577, defaddr=127.0.0.1:4577 maxms=2000, lastms=3
[Nov 5 14:53:22] DEBUG[10687] devicestate.c: Changing state for IAX2/8007 - state 0 (Unknown)
[Nov 5 14:53:22] DEBUG[10704] res_odbc.c: Reusing ODBC handle 0x320e8f8 from class ‘asterisk’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Skip: 0; SQL: UPDATE iaxpeers SET ipaddr=?, regseconds=?, port=? WHERE name=?
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 1 (‘ipaddr’) = ‘127.0.0.1’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 2 (‘regseconds’) = ‘1509890002’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 3 (‘port’) = ‘4573’
[Nov 5 14:53:22] DEBUG[10704] res_config_odbc.c: Parameter 4 = ‘8007’
[Nov 5 14:53:22] DEBUG[10704] res_odbc.c: Releasing ODBC handle 0x320e8f8 into pool
[Nov 5 14:53:22] DEBUG[10704] chan_iax2.c: peercnt entry 127.0.0.1 modified limit:2048 registered:0[Nov 5 14:53:22] VERBOSE[10704] chan_iax2.c: Registered IAX2 ‘8007’ (AUTHENTICATED) at 127.0.0.1:4573


iaxmodem:
root@fax:~# cat /etc/iaxmodem/ttyIAX08
device /dev/ttyIAX08
owner root:root
mode 660
port 4578
refresh 60
server 127.0.0.1
peername 9908
secret fax
codec alaw

database:
id, name, type, secret, context, host, ipaddr, port, auth, requirecalltoken, transfer, disallow, allow, qualify
’1’, ‘9901’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4571’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘2’, ‘9902’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4572’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘3’, ‘9903’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4573’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘4’, ‘9904’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4574’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘5’, ‘9905’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4575’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘6’, ‘9906’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4576’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘7’, ‘9907’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4577’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘8’, ‘9908’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4578’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘9’, ‘9909’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4579’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’
‘10’, ‘9910’, ‘friend’, ‘fax’, ‘from-fax’, ‘dynamic’, ‘127.0.0.1’, ‘4580’, ‘plaintext’, ‘no’, ‘no’, ‘all’, ‘alaw’, ‘yes’