[Home]

Summary:ASTERISK-15499: [patch] warning about "Invalid peer port configuration" for realtime
Reporter:Walter Doekes (wdoekes)Labels:
Date Opened:2010-01-24 03:10:32.000-0600Date Closed:2010-02-18 15:53:22.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/DatabaseSupport
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) astsvn-no_rtdynamic_port_warning.diff
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.
Comments:By: Guilherme Goes (glwgoes) 2010-01-25 13:05:54.000-0600

Tested here on a patched asterisk-1.6.1.13 with asterisk-addons-1.6.1.2 and it works perfectly.

By: Digium Subversion (svnbot) 2010-02-18 15:42:54.000-0600

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 ASTERISK-15499)
Reported by: wdoekes

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

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

By: Digium Subversion (svnbot) 2010-02-18 15:47:08.000-0600

Repository: asterisk
Revision: 247789

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_sip.c

------------------------------------------------------------------------
r247789 | tilghman | 2010-02-18 15:47:08 -0600 (Thu, 18 Feb 2010) | 24 lines

Merged revisions 247787 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r247787 | tilghman | 2010-02-18 15:42:53 -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 ASTERISK-15499)
  Reported by: wdoekes
........

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

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

By: Digium Subversion (svnbot) 2010-02-18 15:49:36.000-0600

Repository: asterisk
Revision: 247790

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_sip.c

------------------------------------------------------------------------
r247790 | tilghman | 2010-02-18 15:49:36 -0600 (Thu, 18 Feb 2010) | 24 lines

Merged revisions 247787 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r247787 | tilghman | 2010-02-18 15:42:53 -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 ASTERISK-15499)
  Reported by: wdoekes
........

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

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

By: Digium Subversion (svnbot) 2010-02-18 15:53:22.000-0600

Repository: asterisk
Revision: 247792

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r247792 | tilghman | 2010-02-18 15:53:21 -0600 (Thu, 18 Feb 2010) | 24 lines

Merged revisions 247787 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r247787 | tilghman | 2010-02-18 15:42:53 -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 ASTERISK-15499)
  Reported by: wdoekes
........

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

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