[asterisk-commits] tilghman: branch 1.4 r217917 - in /branches/1.4: channels/ contrib/scripts/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 10 18:15:25 CDT 2009


Author: tilghman
Date: Thu Sep 10 18:15:21 2009
New Revision: 217917

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217917
Log:
Backport realtime fix to 1.4

Modified:
    branches/1.4/channels/chan_iax2.c
    branches/1.4/channels/chan_sip.c
    branches/1.4/contrib/scripts/iax-friends.sql

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=217917&r1=217916&r2=217917
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Thu Sep 10 18:15:21 2009
@@ -783,6 +783,7 @@
 
 static void reg_source_db(struct iax2_peer *p);
 static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
+static struct iax2_user *realtime_user(const char *username, struct sockaddr_in *sin);
 
 static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt);
 
@@ -1783,7 +1784,11 @@
 	/* ----- Case 2 ----- */
 	if ((subclass == IAX_COMMAND_NEW) && (user = find_user(find))) {
 		calltoken_required = user->calltoken_required;
-	} else if ((subclass != IAX_COMMAND_NEW) && (peer = find_peer(find, 1))) {
+	} else if ((subclass == IAX_COMMAND_NEW) && (user = realtime_user(find, sin))) {
+		calltoken_required = user->calltoken_required;
+	} else if ((subclass != IAX_COMMAND_NEW) && (peer = find_peer(find, 0))) {
+		calltoken_required = peer->calltoken_required;
+	} else if ((subclass != IAX_COMMAND_NEW) && (peer = realtime_peer(find, sin))) {
 		calltoken_required = peer->calltoken_required;
 	}
 
@@ -3686,7 +3691,7 @@
 				if (!strcasecmp(tmp->name, "host")) {
 					struct ast_hostent ahp;
 					struct hostent *hp;
-					if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
+					if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
 						/* No match */
 						ast_variables_destroy(var);
 						var = NULL;
@@ -3800,7 +3805,7 @@
 				if (!strcasecmp(tmp->name, "host")) {
 					struct ast_hostent ahp;
 					struct hostent *hp;
-					if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
+					if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
 						/* No match */
 						ast_variables_destroy(var);
 						var = NULL;

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=217917&r1=217916&r2=217917
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Sep 10 18:15:21 2009
@@ -2657,7 +2657,7 @@
 					if (!strcasecmp(tmp->name, "host")) {
 						struct hostent *hp;
 						struct ast_hostent ahp;
-						if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
+						if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
 							/* No match */
 							ast_variables_destroy(var);
 							var = NULL;

Modified: branches/1.4/contrib/scripts/iax-friends.sql
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/contrib/scripts/iax-friends.sql?view=diff&rev=217917&r1=217916&r2=217917
==============================================================================
--- branches/1.4/contrib/scripts/iax-friends.sql (original)
+++ branches/1.4/contrib/scripts/iax-friends.sql Thu Sep 10 18:15:21 2009
@@ -4,51 +4,54 @@
 
 CREATE TABLE `iaxfriends` (
   `name` varchar(40) NOT NULL default '',
-  `username` varchar(40) NOT NULL default '',
-  `secret` varchar(40) NOT NULL default '',
-  `dbsecret` varchar(40) NOT NULL default '',
-  `context` varchar(40) NOT NULL default '',
-  `regcontext` varchar(40) NOT NULL default '',
-  `host` varchar(40) NOT NULL default 'dynamic',
-  `ipaddr` varchar(20) NOT NULL default '',
-  `port` int(6) NOT NULL default '0',
-  `defaultip` varchar(20) NOT NULL default '',
-  `sourceaddress` varchar(20) NOT NULL default '',
-  `mask` varchar(20) NOT NULL default '',
-  `regexten` varchar(40) NOT NULL default '',
-  `regseconds` int(11) NOT NULL default '0',
-  `accountcode` varchar(20) NOT NULL default '', 
-  `mohinterpret` varchar(20) NOT NULL default '', 
-  `mohsuggest` varchar(20) NOT NULL default '', 
-  `inkeys` varchar(40) NOT NULL default '', 
-  `outkey` varchar(40) NOT NULL default '', 
-  `language` varchar(10) NOT NULL default '', 
-  `callerid` varchar(40) NOT NULL default '', 
-  `cid_number` varchar(40) NOT NULL default '', 
-  `sendani` varchar(10) NOT NULL default '', 
-  `fullname` varchar(40) NOT NULL default '', 
-  `trunk` varchar(10) NOT NULL default '', 
-  `auth` varchar(20) NOT NULL default '', 
-  `maxauthreq` varchar(15) NOT NULL default '', 
-  `encryption` varchar(20) NOT NULL default '', 
-  `transfer` varchar(10) NOT NULL default '', 
-  `jitterbuffer` varchar(10) NOT NULL default '', 
-  `forcejitterbuffer` varchar(10) NOT NULL default '', 
-  `disallow` varchar(40) NOT NULL default 'all', 
-  `allow` varchar(40) NOT NULL default '', 
-  `codecpriority` varchar(40) NOT NULL default '', 
-  `qualify` varchar(10) NOT NULL default '', 
-  `qualifysmoothing` varchar(10) NOT NULL default '', 
-  `qualifyfreqok` varchar(10) NOT NULL default '', 
-  `qualifyfreqnotok` varchar(10) NOT NULL default '', 
-  `timezone` varchar(20) NOT NULL default '', 
-  `adsi` varchar(10) NOT NULL default '', 
-  `amaflags` varchar(20) NOT NULL default '', 
-  `setvar` varchar(200) NOT NULL default '', 
+  `type` varchar(10) NOT NULL default 'friend', -- friend/user/peer
+  `username` varchar(40) NULL, -- username to send as peer
+  `mailbox` varchar(40) NULL, -- mailbox at context
+  `secret` varchar(40) NULL,
+  `dbsecret` varchar(40) NULL, -- In AstDB, location to store/retrieve secret
+  `context` varchar(40) NULL,
+  `regcontext` varchar(40) NULL,
+  `host` varchar(40) NULL default 'dynamic',
+  `ipaddr` varchar(20) NULL, -- Must be updateable by Asterisk user
+  `port` int(5) NULL, -- Must be updateable by Asterisk user
+  `defaultip` varchar(20) NULL,
+  `sourceaddress` varchar(20) NULL,
+  `mask` varchar(20) NULL,
+  `regexten` varchar(40) NULL,
+  `regseconds` int(11) NULL, -- Must be updateable by Asterisk user
+  `accountcode` varchar(20) NULL, 
+  `mohinterpret` varchar(20) NULL, 
+  `mohsuggest` varchar(20) NULL, 
+  `inkeys` varchar(40) NULL, 
+  `outkey` varchar(40) NULL, 
+  `language` varchar(10) NULL, 
+  `callerid` varchar(100) NULL, -- The whole callerid string, or broken down in the next 3 fields
+  `cid_number` varchar(40) NULL, -- The number portion of the callerid
+  `sendani` varchar(10) NULL, -- yes/no
+  `fullname` varchar(40) NULL, -- The name portion of the callerid
+  `trunk` varchar(3) NULL, -- Yes/no
+  `auth` varchar(20) NULL, -- RSA/md5/plaintext
+  `maxauthreq` varchar(5) NULL, -- Maximum outstanding AUTHREQ calls {1-32767}
+  `requirecalltoken` varchar(4) NULL, -- yes/no/auto
+  `encryption` varchar(20) NULL, -- aes128/yes/no
+  `transfer` varchar(10) NULL, -- mediaonly/yes/no
+  `jitterbuffer` varchar(3) NULL, -- yes/no
+  `forcejitterbuffer` varchar(3) NULL, -- yes/no
+  `disallow` varchar(40) NULL, -- all/{list-of-codecs}
+  `allow` varchar(40) NULL, -- all/{list-of-codecs}
+  `codecpriority` varchar(40) NULL, 
+  `qualify` varchar(10) NULL, -- yes/no/{number of milliseconds}
+  `qualifysmoothing` varchar(10) NULL, -- yes/no
+  `qualifyfreqok` varchar(10) NULL, -- {number of milliseconds}|60000
+  `qualifyfreqnotok` varchar(10) NULL, -- {number of milliseconds}|10000
+  `timezone` varchar(20) NULL, 
+  `adsi` varchar(10) NULL, -- yes/no
+  `amaflags` varchar(20) NULL, 
+  `setvar` varchar(200) NULL, 
   PRIMARY KEY  (`name`),
   INDEX name (name, host),
   INDEX name2 (name, ipaddr, port),
   INDEX ipaddr (ipaddr, port),
-  INDEX host (host, port),
-) TYPE=MyISAM;
+  INDEX host (host, port)
+);
 




More information about the asterisk-commits mailing list