Skip to content
Snippets Groups Projects
Commit 5a17ed7a authored by Matthew Jordan's avatar Matthew Jordan
Browse files

channels/chan_sip: Fix RealTime error during SIP unregistration with MariaDB

When a SIP device that has its registration stored in RealTime unregisters,
the entry for that device is updated with blank values, i.e., "", indicating
that it is no longer registered. Unfortunately, one of those values that is
'blanked' is the device's port. If the column type for the port is not a
string datatype (the recommended type is integer), an ODBC or database error
will be thrown. MariaDB does not coerce empty strings to a valid integer value.

This patch updates the query run from chan_sip such that it replaces the port
value with a value of '0', as opposed to a blank value. This is the value that
other database backends coerce the empty string ("") to already, and the
handling of reading a RealTime registration value from a backend already
anticipates receiving a port of '0' from the backends.

ASTERISK-24772 #close
Reported by: Richard Miller
patches:
  chan_sip.diff uploaded by Richard Miller (License 5685)
........

Merged revisions 431673 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 431674 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 8cc50b1e
No related branches found
No related tags found
No related merge requests found
......@@ -15909,7 +15909,7 @@ static void destroy_association(struct sip_peer *peer)
 
if (!sip_cfg.ignore_regexpire) {
if (peer->rt_fromcontact && sip_cfg.peer_rtupdate) {
ast_update_realtime(tablename, "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", "regserver", "", "useragent", "", "lastms", "0", SENTINEL);
ast_update_realtime(tablename, "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "0", "regseconds", "0", "regserver", "", "useragent", "", "lastms", "0", SENTINEL);
} else {
ast_db_del("SIP/Registry", peer->name);
ast_db_del("SIP/RegistryPath", peer->name);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment