[Home]

Summary:ASTERISK-11104: iax2 show peers are showing duplicate lines
Reporter:Niklas Larsson (pnlarsson)Labels:
Date Opened:2007-12-22 15:32:12.000-0600Date Closed:2007-12-26 10:47:52.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) iax_segfault.txt
Description:After every iax2 reload, an duplicate row is printed with iax2 show peers.

How to reproduce:

iax.conf:
; do not edit this file, this is an auto-generated file by freepbx
; all modifications must be done from the web gui

[general]

; These will all be included in the [general] context
#include iax_general_additional.conf
#include iax_general_custom.conf
#include iax_registrations_custom.conf
#include iax_registrations.conf

; These should all be expected to come after the [general] context
;
#include iax_custom.conf
#include iax_additional.conf
#include iax_custom_post.conf

The file iax_additional.conf contains all peers and users. And if iax_custom_post.conf contains any users / peers or is empty then after every iax2 reload you will get another duplicate row.
Comments:By: Niklas Larsson (pnlarsson) 2007-12-22 15:46:55.000-0600

It segfaulted on me now, and i cut out the last part of bt full and attached it. There where 7000 lines before that all looked the same...

By: Michiel van Baak (mvanbaak) 2007-12-22 16:02:28.000-0600

tested it with only 1 include in my iax.conf and got the same.

iax.conf:
[general]
delayreject=yes
disallow=all
allow=ulaw
allow=alaw
allow=gsm
jitterbuffer=no
forcejitterbuffer=no
autokill=yes

register => my_username:my_secret@iax1.provider
register => my_username:[switch.vanbaak.info]@switch01.provider
register => my_username:[switch.vanbaak.info]@switch02.provider


[guest]
type=user
context=default

[vanbaak]
type=user
auth=rsa
inkeys=switch.provider
context=from-provider

#include iax_peers.conf

; vim: set ts=8 sw=2 filetype=asterisk:

iax_peers.conf:
[provider01]
type=peer
username=my_username
auth=rsa
outkey=switch.vanbaak.info
host=switch01.provider
accountcode=outgoing-provider
amaflags=billing
qualify=yes

[provider02]
type=peer
username=my_username
auth=rsa
outkey=switch.vanbaak.info
host=switch02.provider
accountcode=outgoing-provider
amaflags=billing
qualify=yes

[provider03]
type=peer
username=my_username
secret=my_secret
auth=md5
host=iax1.provider
accountcode=outgoing-provider
amaflags=billing
qualify=yes

after a clean start of asterisk I get:
asterisk*CLI> iax2 show peers
Name/Username    Host           Mask             Port          Status    
provider01/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (22 ms)
provider02/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (22 ms)
provider03/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (61 ms)
3 iax2 peers [3 online, 0 offline, 0 unmonitored]
asterisk*CLI>

Now the interesting part:
asterisk*CLI> iax2 reload
 == Parsing '/etc/asterisk/iax.conf':   == Found
 == Parsing '/etc/asterisk/iax_peers.conf':   == Found
 == Parsing '/etc/asterisk/users.conf':   == Found
[2007-12-22 23:01:07] NOTICE[1724]: chan_iax2.c:9449 iax2_poke_peer: Still have a callno...
[2007-12-22 23:01:07] NOTICE[1724]: chan_iax2.c:9449 iax2_poke_peer: Still have a callno...
[2007-12-22 23:01:07] NOTICE[1724]: chan_iax2.c:9449 iax2_poke_peer: Still have a callno...
 == Loaded firmware 'iaxy.bin'
   -- Registered IAX2 to 'x.x.x.x', who sees us as y.y.y.y:64168 with no messages waiting

   -- Registered IAX2 to 'x.x.x.x', who sees us as y.y.y.y:61419 with no messages waiting

   -- Registered IAX2 to 'x.x.x.x', who sees us as y.y.y.y:54104 with no messages waiting

asterisk*CLI> iax2 show peers
Name/Username    Host           Mask             Port          Status    
provider01/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (26 ms)
provider01/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (26 ms)
provider02/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (25 ms)
provider02/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (25 ms)
provider03/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (26 ms)
provider03/vanba  x.x.x.x  (S)  255.255.255.255  4569          OK (26 ms)
6 iax2 peers [6 online, 0 offline, 0 unmonitored]
asterisk*CLI>

By: Michiel van Baak (mvanbaak) 2007-12-22 16:04:49.000-0600

If I put the contents of iax_peers.conf directly into iax.conf this does not happen.

By: Digium Subversion (svnbot) 2007-12-26 10:47:52.000-0600

Repository: asterisk
Revision: 94788

U   trunk/channels/chan_iax2.c

------------------------------------------------------------------------
r94788 | russell | 2007-12-26 10:47:51 -0600 (Wed, 26 Dec 2007) | 5 lines

Fix a bug in peer handling that caused multiple instances of a peer to end up
in the peers container after a reload.  Somehow, this bug doesn't exist in 1.4 ...
(closes issue ASTERISK-11104)
(reported by pnlarsson, additional info from mvanbaak, fixed by me)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=94788