From 25ee5f83b5c9e77be328a92b430d911396f1ac29 Mon Sep 17 00:00:00 2001
From: Walter Doekes <walter+asterisk@wjd.nu>
Date: Tue, 1 Nov 2011 19:53:26 +0000
Subject: [PATCH] Cleanup references to sipusers and sipfriends dynamic
 realtime families

Somewhere between 1.4 and 1.8 the sipusers family has become completely
unused. Before that, the sipfriends family had been obsoleted in favor
of separate sipusers and sippeers families. Apparently, they have been
merged back again into a single family which is now called "sippeers".

Reviewed by: irroot, oej, pabelanger

Review: https://reviewboard.asterisk.org/r/1523
........

Merged revisions 342869 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 342870 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 UPGRADE-1.8.txt                                         | 3 +++
 configs/dbsep.conf.sample                               | 3 +--
 configs/extconfig.conf.sample                           | 1 -
 configs/res_config_mysql.conf.sample                    | 2 +-
 configs/res_ldap.conf.sample                            | 1 -
 contrib/realtime/mysql/{sipfriends.sql => sippeers.sql} | 7 ++++---
 main/config.c                                           | 3 +--
 res/res_realtime.c                                      | 8 ++++----
 8 files changed, 14 insertions(+), 14 deletions(-)
 rename contrib/realtime/mysql/{sipfriends.sql => sippeers.sql} (96%)

diff --git a/UPGRADE-1.8.txt b/UPGRADE-1.8.txt
index 230a5ef401..75efabe7f5 100644
--- a/UPGRADE-1.8.txt
+++ b/UPGRADE-1.8.txt
@@ -311,3 +311,6 @@ From 1.6.0.x to 1.6.1:
   which should be a char(8) or larger.  This field specifies whether or not a
   message has been designated to be "Urgent", "PRIORITY", or not.
 
+* The 'sipusers' realtime table has been removed completely. Use the 'sippeers'
+  table with type 'user' for user type objects.
+
diff --git a/configs/dbsep.conf.sample b/configs/dbsep.conf.sample
index 9e0dd04e0e..9cfa237407 100644
--- a/configs/dbsep.conf.sample
+++ b/configs/dbsep.conf.sample
@@ -17,8 +17,7 @@
 # and res_config_curl.so in modules.conf and configure extconfig.conf:
 #
 # voicemail => curl,http://server/path/to/dbsep.cgi/voicemail
-# sippeers => curl,http://server/path/to/dbsep.cgi/sipfriends
-# sipusers => curl,http://server/path/to/dbsep.cgi/sipfriends
+# sippeers => curl,http://server/path/to/dbsep.cgi/sippeers
 #
 
 # The Data Source Name, as specified by the Perl DBI module.
diff --git a/configs/extconfig.conf.sample b/configs/extconfig.conf.sample
index cc3fa9c9f2..e08674e9d9 100644
--- a/configs/extconfig.conf.sample
+++ b/configs/extconfig.conf.sample
@@ -63,7 +63,6 @@
 ;
 ;iaxusers => odbc,asterisk
 ;iaxpeers => odbc,asterisk
-;sipusers => odbc,asterisk
 ;sippeers => odbc,asterisk
 ;sipregs => odbc,asterisk
 ;voicemail => odbc,asterisk
diff --git a/configs/res_config_mysql.conf.sample b/configs/res_config_mysql.conf.sample
index 79eaf97d26..ab8ebf0950 100644
--- a/configs/res_config_mysql.conf.sample
+++ b/configs/res_config_mysql.conf.sample
@@ -17,7 +17,7 @@
 ; and writes should be performed to the same database.
 ;
 ; For example, in extconfig.conf, you could specify a line like:
-;    sippeers => mysql,readhost.asterisk/writehost.asterisk,sipfriends
+;    sippeers => mysql,readhost.asterisk/writehost.asterisk,sippeers
 ; and then define the contexts [readhost.asterisk] and [writehost.asterisk]
 ; below.
 ;
diff --git a/configs/res_ldap.conf.sample b/configs/res_ldap.conf.sample
index c49fbf1c3c..4655841ec6 100644
--- a/configs/res_ldap.conf.sample
+++ b/configs/res_ldap.conf.sample
@@ -7,7 +7,6 @@
 ; In order to use this module, you start 
 ; in extconfig.conf with a configuration like this:
 ;
-; 	sipusers = ldap,"dc=myDomain,dc=myDomainExt",sip
 ; 	sippeers = ldap,"dc=myDomain,dc=myDomainExt",sip
 ; 	extensions = ldap,"dc=myDomain,dc=myDomainExt",extensions
 ; 	sip.conf = ldap,"dc=myDomain,dc=myDomainExt",config
diff --git a/contrib/realtime/mysql/sipfriends.sql b/contrib/realtime/mysql/sippeers.sql
similarity index 96%
rename from contrib/realtime/mysql/sipfriends.sql
rename to contrib/realtime/mysql/sippeers.sql
index 07cd8788aa..2393dd4763 100644
--- a/contrib/realtime/mysql/sipfriends.sql
+++ b/contrib/realtime/mysql/sippeers.sql
@@ -1,8 +1,8 @@
 #
-# Table structure for table `sipfriends`
+# Table structure for table `sippeers`
 #
 
-CREATE TABLE IF NOT EXISTS `sipfriends` (
+CREATE TABLE IF NOT EXISTS `sippeers` (
       `id` int(11) NOT NULL AUTO_INCREMENT,
       `name` varchar(10) NOT NULL,
       `ipaddr` varchar(15) DEFAULT NULL,
@@ -28,7 +28,8 @@ CREATE TABLE IF NOT EXISTS `sipfriends` (
       `callgroup` varchar(40) DEFAULT NULL,
       `pickupgroup` varchar(40) DEFAULT NULL,
       `language` varchar(40) DEFAULT NULL,
-      `allow` varchar(200) DEFAULT NULL,
+      `allow` varchar(40) DEFAULT NULL,
+      `disallow` varchar(40) DEFAULT NULL,
       `insecure` varchar(40) DEFAULT NULL,
       `trustrpid` enum('yes','no') DEFAULT NULL,
       `progressinband` enum('yes','no','never') DEFAULT NULL,
diff --git a/main/config.c b/main/config.c
index 6381a53f57..23d98da8af 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2146,8 +2146,7 @@ int read_config_maps(void)
 		if (!driver || !database)
 			continue;
 		if (!strcasecmp(v->name, "sipfriends")) {
-			ast_log(LOG_WARNING, "The 'sipfriends' table is obsolete, update your config to use sipusers and sippeers, though they can point to the same table.\n");
-			append_mapping("sipusers", driver, database, table ? table : "sipfriends", pri);
+			ast_log(LOG_WARNING, "The 'sipfriends' table is obsolete, update your config to use sippeers instead.\n");
 			append_mapping("sippeers", driver, database, table ? table : "sipfriends", pri);
 		} else if (!strcasecmp(v->name, "iaxfriends")) {
 			ast_log(LOG_WARNING, "The 'iaxfriends' table is obsolete, update your config to use iaxusers and iaxpeers, though they can point to the same table.\n");
diff --git a/res/res_realtime.c b/res/res_realtime.c
index 8b1488fe48..b26cde5b34 100644
--- a/res/res_realtime.c
+++ b/res/res_realtime.c
@@ -93,8 +93,8 @@ static char *cli_realtime_update(struct ast_cli_entry *e, int cmd, struct ast_cl
 			"Usage: realtime update <family> <colmatch> <valuematch> <colupdate> <newvalue>\n"
 			"       Update a single variable using the RealTime driver.\n"
 			"       You must supply a family name, a column to update on, a new value, column to match, and value to match.\n"
-			"       Ex: realtime update sipfriends name bobsphone port 4343\n"
-			"       will execute SQL as UPDATE sipfriends SET port = 4343 WHERE name = bobsphone\n";
+			"       Ex: realtime update sippeers name bobsphone port 4343\n"
+			"       will execute SQL as UPDATE sippeers SET port = 4343 WHERE name = bobsphone\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
@@ -127,9 +127,9 @@ static char *cli_realtime_update2(struct ast_cli_entry *e, int cmd, struct ast_c
 			"   Update a single variable, requiring one or more fields to match using the\n"
 			"   RealTime driver.  You must supply a family name, a column to update, a new\n"
 			"   value, and at least one column and value to match.\n"
-			"   Ex: realtime update sipfriends name bobsphone ipaddr 127.0.0.1 NULL port 4343\n"
+			"   Ex: realtime update sippeers name bobsphone ipaddr 127.0.0.1 NULL port 4343\n"
 			"   will execute SQL as\n"
-			"   UPDATE sipfriends SET port='4343' WHERE name='bobsphone' and ipaddr='127.0.0.1'\n";
+			"   UPDATE sippeers SET port='4343' WHERE name='bobsphone' and ipaddr='127.0.0.1'\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
-- 
GitLab