summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-02-18 21:42:53 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-02-18 21:42:53 +0000
commit6fb7e0ece70d042cb30271ca14c5e6f82fdea2ca (patch)
tree2b9cdbed287736b40eea1502f574a49516b9eedc /channels/chan_sip.c
parenteb31f8b082a0b1e24a4127f20287f3ec00e71ee9 (diff)
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 #16683) Reported by: wdoekes git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6fa8e090f..aa3a70650 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -23007,7 +23007,12 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
} else if (!strcasecmp(v->name, "port")) {
peer->portinuri = 1;
if (!(port = port_str2int(v->value, 0))) {
- ast_log(LOG_WARNING, "Invalid peer port configuration at line %d : %s\n", v->lineno, v->value);
+ if (realtime) {
+ /* If stored as integer, could be 0 for some DBs (notably MySQL) */
+ peer->portinuri = 0;
+ } else {
+ ast_log(LOG_WARNING, "Invalid peer port configuration at line %d : %s\n", v->lineno, v->value);
+ }
}
} else if (!strcasecmp(v->name, "callingpres")) {
peer->callingpres = ast_parse_caller_presentation(v->value);