[asterisk-dev] "sip reload" messes up port information
Edwin Groothuis
edwin at mavetju.org
Thu Mar 2 01:43:53 MST 2006
On Thu, Mar 02, 2006 at 09:17:58AM +0100, Olle E Johansson wrote:
> 2 mar 2006 kl. 09.05 skrev Edwin Groothuis:
>
> >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]
>
> This is with your patch, not the default chan_sip. I'll look into
It also happens with a virgin chan_sip.c. But I must mention, this
is HEAD (or TRUNK) we're talking about:
*CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
mghome 10.192.13.14 N 5060 UNKNOWN
michaelg (Unspecified) D N 0 Unmonitored
edwin/edwin 192.168.1.245 D N 5061 Unmonitored
3 sip peers [2 online , 1 offline]
*CLI> sip reload
*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 [2 online , 1 offline]
The problem I mentioned here was the changes in port numbers:
- Port 0 replaced by 5060
- Port 5061 replaced by 5060
And if you check the unaltered code of chan_sip.c:
if (pstatus == 0)
peers_offline++;
else { /* Unmonitored */
/* Checking if port is 0 */
if ( ntohs(iterator->addr.sin_port) == 0 ) {
peers_offline++;
} else {
peers_online++;
}
}
Even here the code checks for addr.sin_port being 0 to find an
offline peer, which fails when the sin_port is set to 5060 by "sip
reload".
> I do not like the X+Y message, I think it is confusing.
Ofcourse. One of the reasons I submit patches is to give others my
idea of how I think it could be, while others can give their idea
about it.
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