[asterisk-commits] twilson: branch 1.8 r354348 - in /branches/1.8: channels/ contrib/realtime/po...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 7 14:53:09 CST 2012


Author: twilson
Date: Tue Feb  7 14:53:02 2012
New Revision: 354348

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=354348
Log:
Fix multiple SIP realtime issues

1. Set lastms to 0 when clearing instead of ""
2. Don't set ipaddr or port to the string "(null)" when they are empty
3. Add missing required fields, set default for lastms to 0, and modify
   the length of the ipaddr field to 45 in the Postgresql realtime.sql
   file.

(closes issue ASTERISK-19172)
Review: https://reviewboard.asterisk.org/r/1703/

Modified:
    branches/1.8/channels/chan_sip.c
    branches/1.8/contrib/realtime/postgresql/realtime.sql

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=354348&r1=354347&r2=354348
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Tue Feb  7 14:53:02 2012
@@ -4517,8 +4517,8 @@
 
 	snprintf(str_lastms, sizeof(str_lastms), "%d", lastms);
 	snprintf(regseconds, sizeof(regseconds), "%d", (int)nowtime);	/* Expiration time */
-	ast_copy_string(ipaddr, ast_sockaddr_stringify_addr(addr), sizeof(ipaddr));
-	ast_copy_string(port, ast_sockaddr_stringify_port(addr), sizeof(port));
+	ast_copy_string(ipaddr, ast_sockaddr_isnull(addr) ? "" : ast_sockaddr_stringify_addr(addr), sizeof(ipaddr));
+	ast_copy_string(port, ast_sockaddr_port(addr) ? ast_sockaddr_stringify_port(addr) : "", sizeof(port));
 
 	if (ast_strlen_zero(sysname))	/* No system name, disable this */
 		sysname = NULL;
@@ -13651,7 +13651,7 @@
 
 	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", "", SENTINEL);
+			ast_update_realtime(tablename, "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", "regserver", "", "useragent", "", "lastms", "0", SENTINEL);
 		} else {
 			ast_db_del("SIP/Registry", peer->name);
 			ast_db_del("SIP/PeerMethods", peer->name);

Modified: branches/1.8/contrib/realtime/postgresql/realtime.sql
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/contrib/realtime/postgresql/realtime.sql?view=diff&rev=354348&r1=354347&r2=354348
==============================================================================
--- branches/1.8/contrib/realtime/postgresql/realtime.sql (original)
+++ branches/1.8/contrib/realtime/postgresql/realtime.sql Tue Feb  7 14:53:02 2012
@@ -65,10 +65,14 @@
 allow character varying(100) DEFAULT 'g729;ilbc;gsm;ulaw;alaw',
 musiconhold character varying(100),
 regseconds bigint DEFAULT 0::bigint NOT NULL,
-ipaddr character varying(40) DEFAULT '' NOT NULL,
+ipaddr character varying(45) DEFAULT '' NOT NULL,
 regexten character varying(80) DEFAULT '' NOT NULL,
 cancallforward character varying(3) DEFAULT 'yes',
-lastms integer DEFAULT -1 NOT NULL
+lastms integer DEFAULT 0 NOT NULL,
+defaultuser character varying(80),
+fullcontact character varying(80),
+regserver character varying(30),
+useragent character varying(40)
 );
 
 drop table voicemail_users;




More information about the asterisk-commits mailing list