[asterisk-bugs] [Asterisk 0016683]: [patch] warning about "Invalid peer port configuration" for realtime

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Feb 18 15:42:55 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16683 
====================================================================== 
Reported By:                wdoekes
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16683
Category:                   Channels/chan_sip/DatabaseSupport
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
JIRA:                       SWP-786 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!): 242602 
Request Review:              
====================================================================== 
Date Submitted:             2010-01-24 03:10 CST
Last Modified:              2010-02-18 15:42 CST
====================================================================== 
Summary:                    [patch] warning about "Invalid peer port
configuration" for realtime
Description: 
When my (x-lite) phone unregisters, asterisk sets the realtime sipregs info
to:

mysql> select ipaddr, port from asterisk_sipreg where name = '126680005';
+---------+------+
| ipaddr  | port |
+---------+------+
| 0.0.0.0 |    0 | 
+---------+------+
1 row in set (0.00 sec)


This is all perfectly fine. But then when I retrieve the info for the
account, I get a warning about the port being bad:

CLI> sip show peer 126680005 load
..
[2010-01-24 09:58:04] WARNING[31055]: chan_sip.c:22868 build_peer: Invalid
peer port configuration at line 0 : 0


This new warning was introduced in r221697.

-if (!realtime && peer->host_dynamic) {
-  peer->defaddr.sin_port = htons(atoi(v->value));
-} else {
-  peer->addr.sin_port = htons(atoi(v->value));
+if (!(port = port_str2int(v->value, 0))) {
+  ast_log(LOG_WARNING, "Invalid peer port configuration at line %d :
%s\n", v->lineno, v->value);


I suppose it shouldn't fire the warning when you're using realtime-dynamic
accounts.

See the attached diff.


Regards,
Walter Doekes
OSSO B.V.
====================================================================== 

---------------------------------------------------------------------- 
 (0118254) svnbot (reporter) - 2010-02-18 15:42
 https://issues.asterisk.org/view.php?id=16683#c118254 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 247787

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r247787 | tilghman | 2010-02-18 15:42:54 -0600 (Thu, 18 Feb 2010) | 17
lines

If the peer record is from realtime, it could be set to 0, due to MySQL
not representing NULL well in integer columns.

NULL means the value is not specified for the column, which normally means
the driver uses whatever is the default value.  However, on MySQL, placing
a NULL in either a float or integer column results in a retrieval of the 0
value.  Hence, users get an errant error on load.  This patch suppresses
that error and makes the value as if it was not there.

Note that this cannot be done in the realtime driver, because the lack of
difference between NULL and 0 can only be intepreted correctly by the
driver itself.  If we did it in the realtime driver, then it would be
effectively impossible to set any realtime field to 0, because it would
act
as if the field were unspecified and possibly take on a different value.

(closes issue https://issues.asterisk.org/view.php?id=16683)
 Reported by: wdoekes

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-02-18 15:42 svnbot         Checkin                                      
2010-02-18 15:42 svnbot         Note Added: 0118254                          
======================================================================




More information about the asterisk-bugs mailing list