[asterisk-dev] "sip reload" messes up port information

Edwin Groothuis edwin at mavetju.org
Thu Mar 2 01:05:18 MST 2006


This is the output of "sip show peers":

*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status
mghome                     10.192.13.14         N      5060     UNREACHABLE   
michaelg                   (Unspecified)    D   N      0        Unmonitored
edwin/edwin                192.168.1.245    D   N      5061     Unmonitored
3 sip peers [0+1 online, 1 offline, 1 unmonitored]

Now I do a "sip reload" and it changes to: 

*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status
mghome                     10.192.13.14         N      5060     UNREACHABLE
michaelg                   (Unspecified)    D   N      5060     Unmonitored
edwin/edwin                192.168.1.245    D   N      5060     Unmonitored
3 sip peers [0+2 online, 1 offline, 0 unmonitored]

What has happened here:

- peer "michaelg" has gotten a port.
- peer "edwin" has moved back from 5061 to 5060.

With the result that:

- the logic of "sip show peers" sees the peer "michaelg" now as online.
- the peer "edwin" can't be accessed anymore until he has reregistered again.


During the startup of asterisk, the value of the port comes back
without problems. That is because build_peer() calls reg_source_db(),
which gets this information again. But during the "sip reload", it
doesn't do this because the the peer is already in the peerl (first
ten lines of build_peer()).


Reload_config(), which is calling the build_peer(), has as comment:

\note   This function reloads all config data, except for
        active peers (with registrations). They will only
	change configuration data at restart, not at reload.
	SIP debug and recordhistory state will not change

That will lead to a discussion about what an active pear is: one
registered or one making a phone call?


Is the setting of port 5060 for unregistered peers a good idea?
Harmless, but it interferes with how for example "sip show peers"
thinks about the world.

Is the setting of port 5061 to port 5060 a good idea? No.


I have spend this afternoon going through channels/chan_sip.c (people
on #asterisk have seen my cursing) and don't have a solution except
for calling reg_source_db() at the end of build_peer() whether found
is true or false.


Is there somebody with more ideas of what can wrong with chap_sip.c
who can comment on this?

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin at mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/



More information about the asterisk-dev mailing list