[asterisk-commits] oej: branch oej/no-premature-183 r218148 - in /team/oej/no-premature-183: ./ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 12 09:14:11 CDT 2009


Author: oej
Date: Sat Sep 12 09:14:05 2009
New Revision: 218148

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218148
Log:
reset automerge, move on.

Modified:
    team/oej/no-premature-183/   (props changed)
    team/oej/no-premature-183/apps/app_queue.c
    team/oej/no-premature-183/channels/chan_iax2.c
    team/oej/no-premature-183/channels/chan_sip.c
    team/oej/no-premature-183/contrib/scripts/iax-friends.sql

Propchange: team/oej/no-premature-183/
------------------------------------------------------------------------------
    automerge = http://www.codename-pineapple.org/

Propchange: team/oej/no-premature-183/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Sep 12 09:14:05 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-217194
+/branches/1.4:1-218147

Modified: team/oej/no-premature-183/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/no-premature-183/apps/app_queue.c?view=diff&rev=218148&r1=218147&r2=218148
==============================================================================
--- team/oej/no-premature-183/apps/app_queue.c (original)
+++ team/oej/no-premature-183/apps/app_queue.c Sat Sep 12 09:14:05 2009
@@ -1948,6 +1948,7 @@
 
 	/* Inherit specially named variables from parent channel */
 	ast_channel_inherit_variables(qe->chan, tmp->chan);
+	ast_channel_datastore_inherit(qe->chan, tmp->chan);
 
 	/* Presense of ADSI CPE on outgoing channel follows ours */
 	tmp->chan->adsicpe = qe->chan->adsicpe;
@@ -2243,7 +2244,11 @@
 			*to = 0;
 			return NULL;
 		}
+
+		/* Poll for events from both the incoming channel as well as any outgoing channels */
 		winner = ast_waitfor_n(watchers, pos, to);
+
+		/* Service all of the outgoing channels */
 		for (o = start; o; o = o->call_next) {
 			if (o->stillgoing && (o->chan) &&  (o->chan->_state == AST_STATE_UP)) {
 				if (!peer) {
@@ -2342,7 +2347,11 @@
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
-								ring_one(qe, outgoing, &numbusies);
+								/* Have enough time for a queue member to answer? */
+								if (*to > 500) {
+									ring_one(qe, outgoing, &numbusies);
+									starttime = (long) time(NULL);
+								}
 							}
 							numbusies++;
 							break;
@@ -2358,7 +2367,10 @@
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart)
 									*to = orig;
-								ring_one(qe, outgoing, &numbusies);
+								if (*to > 500) {
+									ring_one(qe, outgoing, &numbusies);
+									starttime = (long) time(NULL);
+								}
 							}
 							numbusies++;
 							break;
@@ -2374,18 +2386,23 @@
 						}
 					}
 					ast_frfree(f);
-				} else {
+				} else { /* ast_read() returned NULL */
 					endtime = (long) time(NULL) - starttime;
 					rna(endtime * 1000, qe, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 						if (qe->parent->timeoutrestart)
 							*to = orig;
-						ring_one(qe, outgoing, &numbusies);
+						if (*to > 500) {
+							ring_one(qe, outgoing, &numbusies);
+							starttime = (long) time(NULL);
+						}
 					}
 				}
 			}
 		}
+
+		/* If we received an event from the caller, deal with it. */
 		if (winner == in) {
 			f = ast_read(in);
 			if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {

Modified: team/oej/no-premature-183/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/no-premature-183/channels/chan_iax2.c?view=diff&rev=218148&r1=218147&r2=218148
==============================================================================
--- team/oej/no-premature-183/channels/chan_iax2.c (original)
+++ team/oej/no-premature-183/channels/chan_iax2.c Sat Sep 12 09:14:05 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;
@@ -8234,6 +8239,7 @@
 	int new = NEW_PREVENT;
 	void *ptr;
 	int dcallno = 0;
+	char decrypted = 0;
 	struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *)thread->buf;
 	struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *)thread->buf;
 	struct ast_iax2_meta_hdr *meta = (struct ast_iax2_meta_hdr *)thread->buf;
@@ -8410,6 +8416,25 @@
 
 		/* Get the destination call number */
 		dcallno = ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS;
+
+
+		/* check to make sure this full frame isn't encrypted before we attempt
+ 		 * to look inside of it. If it is encrypted, decrypt it first. Its ok if the
+		 * callno is not found here, that just means one hasn't been allocated for
+		 * this connection yet. */
+		if ((dcallno != 1) && (fr->callno = find_callno(ntohs(mh->callno) & ~IAX_FLAG_FULL, dcallno, &sin, NEW_PREVENT, fd, 1))) {
+			ast_mutex_lock(&iaxsl[fr->callno]);
+			if (ast_test_flag(iaxs[fr->callno], IAX_ENCRYPTED)) {
+				if (decrypt_frame(fr->callno, fh, &f, &res)) {
+					ast_log(LOG_NOTICE, "Packet Decrypt Failed!\n");
+					ast_mutex_unlock(&iaxsl[fr->callno]);
+					return 1;
+				}
+				decrypted = 1;
+			}
+			ast_mutex_unlock(&iaxsl[fr->callno]);
+		}
+
 		/* Retrieve the type and subclass */
 		f.frametype = fh->type;
 		if (f.frametype == AST_FRAME_VIDEO) {
@@ -8521,17 +8546,19 @@
 			ast_mutex_unlock(&iaxsl[fr->callno]);
 		return 1;
 	}
-	if (ast_test_flag(iaxs[fr->callno], IAX_ENCRYPTED)) {
+	if (ast_test_flag(iaxs[fr->callno], IAX_ENCRYPTED) && !decrypted) {
 		if (decrypt_frame(fr->callno, fh, &f, &res)) {
 			ast_log(LOG_NOTICE, "Packet Decrypt Failed!\n");
 			ast_mutex_unlock(&iaxsl[fr->callno]);
 			return 1;
-		}
+	}
+		decrypted = 1;
+	}
 #ifdef DEBUG_SUPPORT
-		else if (iaxdebug)
-			iax_showframe(NULL, fh, 3, &sin, res - sizeof(*fh));
+	if (decrypted && iaxdebug) {
+		iax_showframe(NULL, fh, 3, &sin, res - sizeof(*fh));
+	}
 #endif
-	}
 
 	/* count this frame */
 	iaxs[fr->callno]->frames_received++;

Modified: team/oej/no-premature-183/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/no-premature-183/channels/chan_sip.c?view=diff&rev=218148&r1=218147&r2=218148
==============================================================================
--- team/oej/no-premature-183/channels/chan_sip.c (original)
+++ team/oej/no-premature-183/channels/chan_sip.c Sat Sep 12 09:14:05 2009
@@ -1832,11 +1832,6 @@
 			res = XMIT_ERROR;	/* Don't bother with trying to transmit again */
 		}
 
-		if (p->registry && p->registry->regstate < REG_STATE_REGISTERED) {
-			AST_SCHED_DEL(sched, p->registry->timeout);
-			p->registry->needdns = TRUE;
-			p->registry->timeout = ast_sched_add(sched, 1, sip_reg_timeout, p->registry);
-		}
 	}
 
 	if (res != len)
@@ -2662,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: team/oej/no-premature-183/contrib/scripts/iax-friends.sql
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/no-premature-183/contrib/scripts/iax-friends.sql?view=diff&rev=218148&r1=218147&r2=218148
==============================================================================
--- team/oej/no-premature-183/contrib/scripts/iax-friends.sql (original)
+++ team/oej/no-premature-183/contrib/scripts/iax-friends.sql Sat Sep 12 09:14:05 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