[svn-commits] oej: branch oej/deluxepine-1.4 r278558 - in /team/oej/deluxepine-1.4: ./ apps...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 21 14:21:44 CDT 2010


Author: oej
Date: Wed Jul 21 14:21:32 2010
New Revision: 278558

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=278558
Log:
Resolve conflict

Added:
    team/oej/deluxepine-1.4/contrib/realtime/
      - copied from r278261, branches/1.4/contrib/realtime/
    team/oej/deluxepine-1.4/contrib/realtime/mysql/
      - copied from r278261, branches/1.4/contrib/realtime/mysql/
    team/oej/deluxepine-1.4/contrib/realtime/mysql/iaxfriends.sql
      - copied unchanged from r278261, branches/1.4/contrib/realtime/mysql/iaxfriends.sql
    team/oej/deluxepine-1.4/contrib/realtime/mysql/meetme.sql
      - copied unchanged from r278261, branches/1.4/contrib/realtime/mysql/meetme.sql
    team/oej/deluxepine-1.4/contrib/realtime/mysql/sipfriends.sql
      - copied unchanged from r278261, branches/1.4/contrib/realtime/mysql/sipfriends.sql
    team/oej/deluxepine-1.4/contrib/realtime/mysql/voicemail.sql
      - copied unchanged from r278261, branches/1.4/contrib/realtime/mysql/voicemail.sql
    team/oej/deluxepine-1.4/contrib/realtime/oracle/
      - copied from r278261, branches/1.4/contrib/realtime/oracle/
    team/oej/deluxepine-1.4/contrib/realtime/postgresql/
      - copied from r278261, branches/1.4/contrib/realtime/postgresql/
    team/oej/deluxepine-1.4/contrib/realtime/postgresql/realtime.sql
      - copied unchanged from r278261, branches/1.4/contrib/realtime/postgresql/realtime.sql
    team/oej/deluxepine-1.4/contrib/realtime/sqlserver/
      - copied from r278261, branches/1.4/contrib/realtime/sqlserver/
    team/oej/deluxepine-1.4/include/asterisk/test.h
      - copied unchanged from r278261, branches/1.4/include/asterisk/test.h
    team/oej/deluxepine-1.4/main/test.c
      - copied unchanged from r278261, branches/1.4/main/test.c
    team/oej/deluxepine-1.4/tests/
      - copied from r278261, branches/1.4/tests/
    team/oej/deluxepine-1.4/tests/Makefile
      - copied unchanged from r278261, branches/1.4/tests/Makefile
    team/oej/deluxepine-1.4/tests/test_astobj2.c
      - copied unchanged from r278261, branches/1.4/tests/test_astobj2.c
    team/oej/deluxepine-1.4/tests/test_skel.c
      - copied unchanged from r278261, branches/1.4/tests/test_skel.c
Removed:
    team/oej/deluxepine-1.4/contrib/scripts/iax-friends.sql
    team/oej/deluxepine-1.4/contrib/scripts/meetme.sql
    team/oej/deluxepine-1.4/contrib/scripts/realtime_pgsql.sql
    team/oej/deluxepine-1.4/contrib/scripts/sip-friends.sql
    team/oej/deluxepine-1.4/contrib/scripts/vmdb.sql
Modified:
    team/oej/deluxepine-1.4/   (props changed)
    team/oej/deluxepine-1.4/Makefile
    team/oej/deluxepine-1.4/apps/app_amd.c
    team/oej/deluxepine-1.4/apps/app_dial.c
    team/oej/deluxepine-1.4/apps/app_meetme.c
    team/oej/deluxepine-1.4/apps/app_queue.c
    team/oej/deluxepine-1.4/apps/app_voicemail.c
    team/oej/deluxepine-1.4/autoconf/ast_func_fork.m4
    team/oej/deluxepine-1.4/build_tools/cflags-devmode.xml
    team/oej/deluxepine-1.4/channels/chan_agent.c
    team/oej/deluxepine-1.4/channels/chan_dahdi.c
    team/oej/deluxepine-1.4/channels/chan_h323.c
    team/oej/deluxepine-1.4/channels/chan_iax2.c
    team/oej/deluxepine-1.4/channels/chan_local.c
    team/oej/deluxepine-1.4/channels/chan_misdn.c
    team/oej/deluxepine-1.4/channels/chan_oss.c
    team/oej/deluxepine-1.4/channels/chan_sip.c
    team/oej/deluxepine-1.4/configs/say.conf.sample
    team/oej/deluxepine-1.4/configs/sip.conf.sample
    team/oej/deluxepine-1.4/configs/voicemail.conf.sample
    team/oej/deluxepine-1.4/configure
    team/oej/deluxepine-1.4/configure.ac
    team/oej/deluxepine-1.4/include/asterisk.h
    team/oej/deluxepine-1.4/include/asterisk/autoconfig.h.in
    team/oej/deluxepine-1.4/include/asterisk/channel.h
    team/oej/deluxepine-1.4/include/asterisk/compiler.h
    team/oej/deluxepine-1.4/include/asterisk/linkedlists.h
    team/oej/deluxepine-1.4/include/asterisk/lock.h
    team/oej/deluxepine-1.4/main/Makefile
    team/oej/deluxepine-1.4/main/asterisk.c
    team/oej/deluxepine-1.4/main/autoservice.c
    team/oej/deluxepine-1.4/main/channel.c
    team/oej/deluxepine-1.4/main/cli.c
    team/oej/deluxepine-1.4/main/config.c
    team/oej/deluxepine-1.4/main/loader.c
    team/oej/deluxepine-1.4/main/manager.c
    team/oej/deluxepine-1.4/main/pbx.c
    team/oej/deluxepine-1.4/main/rtp.c
    team/oej/deluxepine-1.4/res/res_agi.c
    team/oej/deluxepine-1.4/res/res_config_odbc.c
    team/oej/deluxepine-1.4/res/res_config_pgsql.c
    team/oej/deluxepine-1.4/res/res_features.c
    team/oej/deluxepine-1.4/res/res_jabber.c

Propchange: team/oej/deluxepine-1.4/
------------------------------------------------------------------------------
    automerge = http://www.codename-pineapple.org/

Propchange: team/oej/deluxepine-1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 21 14:21:32 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-272830
+/branches/1.4:1-278538

Modified: team/oej/deluxepine-1.4/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/Makefile?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/Makefile (original)
+++ team/oej/deluxepine-1.4/Makefile Wed Jul 21 14:21:32 2010
@@ -265,7 +265,7 @@
 
 _ASTCFLAGS+=$(BUSYDETECT)$(OPTIONS)
 
-MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
+MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs tests main
 OTHER_SUBDIRS:=utils agi
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)

Modified: team/oej/deluxepine-1.4/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/apps/app_amd.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/apps/app_amd.c (original)
+++ team/oej/deluxepine-1.4/apps/app_amd.c Wed Jul 21 14:21:32 2010
@@ -215,10 +215,11 @@
 
 		if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_NULL || f->frametype == AST_FRAME_CNG) {
 			/* If the total time exceeds the analysis time then give up as we are not too sure */
-			if (f->frametype == AST_FRAME_VOICE)
+			if (f->frametype == AST_FRAME_VOICE) {
 				framelength = (ast_codec_get_samples(f) / DEFAULT_SAMPLES_PER_MS);
-			else
-				framelength += 2 * maxWaitTimeForFrame;
+			} else {
+				framelength = 2 * maxWaitTimeForFrame;
+			}
 
 			iTotalTime += framelength;
 			if (iTotalTime >= totalAnalysisTime) {

Modified: team/oej/deluxepine-1.4/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/apps/app_dial.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/apps/app_dial.c (original)
+++ team/oej/deluxepine-1.4/apps/app_dial.c Wed Jul 21 14:21:32 2010
@@ -1707,6 +1707,11 @@
 		}
 
 		if (chan && peer && ast_test_flag(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
+			/* chan and peer are going into the PBX, they both
+			 * should probably get CDR records. */
+			ast_clear_flag(chan->cdr, AST_CDR_FLAG_DIALED);
+			ast_clear_flag(peer->cdr, AST_CDR_FLAG_DIALED);
+
 			replace_macro_delimiter(opt_args[OPT_ARG_GOTO]);
 			ast_parseable_goto(chan, opt_args[OPT_ARG_GOTO]);
 			/* peer goes to the same context and extension as chan, so just copy info from chan*/

Modified: team/oej/deluxepine-1.4/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/apps/app_meetme.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/apps/app_meetme.c (original)
+++ team/oej/deluxepine-1.4/apps/app_meetme.c Wed Jul 21 14:21:32 2010
@@ -362,7 +362,7 @@
 	struct ast_frame *transframe[32];
 	struct ast_frame *origframe;
 	struct ast_trans_pvt *transpath[32];
-	AST_LIST_HEAD_NOLOCK(, ast_conf_user) userlist;
+	struct ao2_container *usercontainer;
 	AST_LIST_ENTRY(ast_conference) list;
 	/* announce_thread related data */
 	pthread_t announcethread;
@@ -752,6 +752,30 @@
 		ast_autoservice_stop(chan);
 }
 
+static int user_no_cmp(void *obj, void *arg, int flags)
+{
+	struct ast_conf_user *user = obj;
+	int *user_no = arg;
+
+	if (user->user_no == *user_no) {
+		return (CMP_MATCH | CMP_STOP);
+	}
+
+	return 0;
+}
+
+static int user_max_cmp(void *obj, void *arg, int flags)
+{
+	struct ast_conf_user *user = obj;
+	int *max_no = arg;
+
+	if (user->user_no > *max_no) {
+		*max_no = user->user_no;
+	}
+
+	return 0;
+}
+
 /*!
  * \brief Find or create a conference
  *
@@ -782,8 +806,10 @@
 		goto cnfout;
 
 	/* Make a new one */
-	if (!(cnf = ast_calloc(1, sizeof(*cnf))))
+	if (!(cnf = ast_calloc(1, sizeof(*cnf))) ||
+		!(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) {
 		goto cnfout;
+	}
 
 	ast_mutex_init(&cnf->playlock);
 	ast_mutex_init(&cnf->listenlock);
@@ -939,6 +965,7 @@
 			strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
 		}	
 	} else if(strcmp(argv[1], "list") == 0) {
+		struct ao2_iterator user_iter;
 		int concise = ( 4 == argc && ( !strcasecmp(argv[3], "concise") ) );
 		/* List all the users in a conference */
 		if (AST_LIST_EMPTY(&confs)) {
@@ -960,11 +987,12 @@
 		}
 		/* Show all the users */
 		time(&now);
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
+		user_iter = ao2_iterator_init(cnf->usercontainer, 0);
+		while((user = ao2_iterator_next(&user_iter))) {
 			hr = (now - user->jointime) / 3600;
 			min = ((now - user->jointime) % 3600) / 60;
 			sec = (now - user->jointime) % 60;
-			if ( !concise )
+			if (!concise) {
 				ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %02d:%02d:%02d\n",
 					user->user_no,
 					S_OR(user->chan->cid.cid_num, "<unknown>"),
@@ -974,7 +1002,7 @@
 					user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
 					user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "",
 					istalking(user->talking), hr, min, sec); 
-			else 
+			} else {
 				ast_cli(fd, "%d!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
 					user->user_no,
 					S_OR(user->chan->cid.cid_num, ""),
@@ -984,8 +1012,10 @@
 					user->userflags  & CONFFLAG_MONITOR ? "1" : "",
 					user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)  ? "1" : "",
 					user->talking, hr, min, sec);
-			
-		}
+			}
+			ao2_ref(user, -1);
+		}
+		ao2_iterator_destroy(&user_iter);
 		if ( !concise )
 			ast_cli(fd,"%d users in that conference.\n",cnf->users);
 		AST_LIST_UNLOCK(&confs);
@@ -1044,15 +1074,21 @@
 			}
 
 			if (cnf) {
+				struct ao2_iterator user_iter;
+				user_iter = ao2_iterator_init(cnf->usercontainer, 0);
 				/* Search for the user */
-				AST_LIST_TRAVERSE(&cnf->userlist, usr, list) {
+				while((usr = ao2_iterator_next(&user_iter))) {
 					snprintf(usrno, sizeof(usrno), "%d", usr->user_no);
-					if (!strncasecmp(word, usrno, len) && ++which > state)
+					if (!strncasecmp(word, usrno, len) && ++which > state) {
+						ao2_ref(usr, -1);
 						break;
+					}
+					ao2_ref(usr, -1);
 				}
+				ao2_iterator_destroy(&user_iter);
+				AST_LIST_UNLOCK(&confs);
+				return usr ? strdup(usrno) : NULL;
 			}
-			AST_LIST_UNLOCK(&confs);
-			return usr ? strdup(usrno) : NULL;
 		} else if ( strstr(line, "list") && ( 0 == state ) )
 			return strdup("concise");
 	}
@@ -1302,6 +1338,9 @@
 		ast_hangup(conf->chan);
 	if (conf->fd >= 0)
 		close(conf->fd);
+	if (conf->usercontainer) {
+		ao2_ref(conf->usercontainer, -1);
+	}
 
 	ast_mutex_destroy(&conf->playlock);
 	ast_mutex_destroy(&conf->listenlock);
@@ -1317,13 +1356,19 @@
 	const struct ast_conf_user *sender, struct ast_frame *f)
 {
 	struct ast_conf_user *user;
-
-	AST_LIST_TRAVERSE(&conf->userlist, user, list) {
-		if (user == sender)
+	struct ao2_iterator user_iter;
+
+	user_iter = ao2_iterator_init(conf->usercontainer, 0);
+	while ((user = ao2_iterator_next(&user_iter))) {
+		if (user == sender) {
+			ao2_ref(user, -1);
 			continue;
+		}
 		if (ast_write(user->chan, f) < 0)
 			ast_log(LOG_WARNING, "Error writing frame to channel %s\n", user->chan->name);
-	}
+		ao2_ref(user, -1);
+	}
+	ao2_iterator_destroy(&user_iter);
 }
 
 static void sla_queue_event_full(enum sla_event_type type, 
@@ -1564,8 +1609,9 @@
 	int setusercount = 0;
 	int confsilence = 0, totalsilence = 0;
 
-	if (!(user = ast_calloc(1, sizeof(*user))))
+	if (!(user = ao2_alloc(sizeof(*user), NULL))) {
 		return ret;
+	}
 
 	/* Possible timeout waiting for marked user */
 	if ((confflags & CONFFLAG_WAITMARKED) &&
@@ -1630,13 +1676,11 @@
 	}
 
    	ast_mutex_lock(&conf->playlock);
-
-	if (AST_LIST_EMPTY(&conf->userlist))
-		user->user_no = 1;
-	else
-		user->user_no = AST_LIST_LAST(&conf->userlist)->user_no + 1;
-
-	AST_LIST_INSERT_TAIL(&conf->userlist, user, list);
+	ao2_lock(conf->usercontainer);
+	ao2_callback(conf->usercontainer, OBJ_NODATA, user_max_cmp, &user->user_no);
+	user->user_no++;
+	ao2_link(conf->usercontainer, user);
+	ao2_unlock(conf->usercontainer);
 
 	user->chan = chan;
 	user->userflags = confflags;
@@ -2202,15 +2246,21 @@
 								}
 								break;
 							case '3': /* Eject last user */
+							{
+								int max_no = 0;
+								ao2_callback(conf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
 								menu_active = 0;
-								usr = AST_LIST_LAST(&conf->userlist);
+								usr = ao2_find(conf->usercontainer, &max_no, 0);
 								if ((usr->chan->name == chan->name)||(usr->userflags & CONFFLAG_ADMIN)) {
 									if(!ast_streamfile(chan, "conf-errormenu", chan->language))
 										ast_waitstream(chan, "");
-								} else 
+								} else {
 									usr->adminflags |= ADMINFLAG_KICKME;
+								}
+								ao2_ref(user, -1);
 								ast_stopstream(chan);
 								break;	
+							}
 							case '4':
 								tweak_listen_volume(user, VOL_DOWN);
 								break;
@@ -2322,6 +2372,20 @@
 					}
 				} else if (f->frametype == AST_FRAME_NULL) {
 					/* Ignore NULL frames. It is perfectly normal to get these if the person is muted. */
+				} else if (f->frametype == AST_FRAME_CONTROL) {
+					switch (f->subclass) {
+					case AST_CONTROL_BUSY:
+					case AST_CONTROL_CONGESTION:
+						ast_frfree(f);
+						goto outrun;
+						break;
+					default:
+						if (option_debug) {
+							ast_log(LOG_DEBUG, 
+								"Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
+								chan->name, f->frametype, f->subclass);
+						}
+					}
 				} else if (option_debug) {
 					ast_log(LOG_DEBUG,
 						"Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
@@ -2456,7 +2520,9 @@
 	if (dsp)
 		ast_dsp_free(dsp);
 	
-	if (user->user_no) { /* Only cleanup users who really joined! */
+	if (!user->user_no) {
+		ao2_ref(user, -1);
+	} else { /* Only cleanup users who really joined! */
 		now = time(NULL);
 		hr = (now - user->jointime) / 3600;
 		min = ((now - user->jointime) % 3600) / 60;
@@ -2486,8 +2552,8 @@
 			if (confflags & CONFFLAG_MARKEDUSER) 
 				conf->markedusers--;
 		}
-		/* Remove ourselves from the list */
-		AST_LIST_REMOVE(&conf->userlist, user, list);
+		/* Remove ourselves from the container */
+		ao2_unlink(conf->usercontainer, user); 
 
 		/* Change any states */
 		if (!conf->users)
@@ -2497,7 +2563,6 @@
 		snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));
 		pbx_builtin_setvar_helper(chan, "MEETMESECS", meetmesecs);
 	}
-	free(user);
 	AST_LIST_UNLOCK(&confs);
 
 	return ret;
@@ -2875,8 +2940,7 @@
 			} else {
 				if (((!ast_strlen_zero(cnf->pin) &&
 				    !ast_test_flag(&confflags, CONFFLAG_ADMIN)) ||
-				    (!ast_strlen_zero(cnf->pinadmin) &&
-				    ast_test_flag(&confflags, CONFFLAG_ADMIN))) &&
+				    !ast_strlen_zero(cnf->pinadmin)) &&
 				    (!(cnf->users == 0 && cnf->isdynamic))) {
 					char pin[MAX_PIN] = "";
 					int j;
@@ -2960,12 +3024,69 @@
 	
 	sscanf(callerident, "%30i", &cid);
 	if (conf && callerident) {
-		AST_LIST_TRAVERSE(&conf->userlist, user, list) {
-			if (cid == user->user_no)
-				return user;
-		}
+		user = ao2_find(conf->usercontainer, &cid, 0);
+		/* reference decremented later in admin_exec */
+		return user;
 	}
 	return NULL;
+}
+
+static int user_set_kickme_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	user->adminflags |= ADMINFLAG_KICKME;
+	return 0;
+}
+
+static int user_set_muted_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	if (!(user->userflags & CONFFLAG_ADMIN)) {
+		user->adminflags |= ADMINFLAG_MUTED;
+	}
+	return 0;
+}
+
+static int user_set_unmuted_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
+	return 0;
+}
+
+static int user_listen_volup_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	tweak_listen_volume(user, VOL_UP);
+	return 0;
+}
+
+static int user_listen_voldown_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	tweak_listen_volume(user, VOL_DOWN);
+	return 0;
+}
+
+static int user_talk_volup_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	tweak_talk_volume(user, VOL_UP);
+	return 0;
+}
+
+static int user_talk_voldown_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	tweak_talk_volume(user, VOL_DOWN);
+	return 0;
+}
+
+static int user_reset_vol_cb(void *obj, void *unused, int flags)
+{
+	struct ast_conf_user *user = obj;
+	reset_volumes(user);
+	return 0;
 }
 
 /*! \brief The MeetMeadmin application */
@@ -3013,8 +3134,13 @@
 
 	ast_atomic_fetchadd_int(&cnf->refcount, 1);
 
-	if (args.user)
+	if (args.user) {
 		user = find_user(cnf, args.user);
+		if (!user) {
+			ast_log(LOG_NOTICE, "Specified User not found!\n");
+			goto usernotfound;
+		}
+	}
 
 	switch (*args.command) {
 	case 76: /* L: Lock */ 
@@ -3024,96 +3150,72 @@
 		cnf->locked = 0;
 		break;
 	case 75: /* K: kick all users */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			user->adminflags |= ADMINFLAG_KICKME;
+		ao2_callback(cnf->usercontainer, 0, user_set_kickme_cb, NULL);
 		break;
 	case 101: /* e: Eject last user*/
-		user = AST_LIST_LAST(&cnf->userlist);
+	{
+		int max_no = 0;
+		ao2_callback(cnf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
+		user = ao2_find(cnf->usercontainer, &max_no, 0);
 		if (!(user->userflags & CONFFLAG_ADMIN))
 			user->adminflags |= ADMINFLAG_KICKME;
 		else
 			ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n");
+		ao2_ref(user, -1);
 		break;
+	}
 	case 77: /* M: Mute */ 
-		if (user) {
-			user->adminflags |= ADMINFLAG_MUTED;
-		} else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		user->adminflags |= ADMINFLAG_MUTED;
 		break;
 	case 78: /* N: Mute all (non-admin) users */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
-			if (!(user->userflags & CONFFLAG_ADMIN))
-				user->adminflags |= ADMINFLAG_MUTED;
-		}
+		ao2_callback(cnf->usercontainer, 0, user_set_muted_cb, NULL);
 		break;					
 	case 109: /* m: Unmute */ 
-		if (user) {
-			user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
-		} else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
 		break;
 	case 110: /* n: Unmute all users */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
+		ao2_callback(cnf->usercontainer, 0, user_set_unmuted_cb, NULL);
 		break;
 	case 107: /* k: Kick user */ 
-		if (user)
-			user->adminflags |= ADMINFLAG_KICKME;
-		else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		user->adminflags |= ADMINFLAG_KICKME;
 		break;
 	case 118: /* v: Lower all users listen volume */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			tweak_listen_volume(user, VOL_DOWN);
+		ao2_callback(cnf->usercontainer, 0, user_listen_voldown_cb, NULL);
 		break;
 	case 86: /* V: Raise all users listen volume */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			tweak_listen_volume(user, VOL_UP);
+		ao2_callback(cnf->usercontainer, 0, user_listen_volup_cb, NULL);
 		break;
 	case 115: /* s: Lower all users speaking volume */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			tweak_talk_volume(user, VOL_DOWN);
+		ao2_callback(cnf->usercontainer, 0, user_talk_voldown_cb, NULL);
 		break;
 	case 83: /* S: Raise all users speaking volume */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			tweak_talk_volume(user, VOL_UP);
+		ao2_callback(cnf->usercontainer, 0, user_talk_volup_cb, NULL);
 		break;
 	case 82: /* R: Reset all volume levels */
-		AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-			reset_volumes(user);
+		ao2_callback(cnf->usercontainer, 0, user_reset_vol_cb, NULL);
 		break;
 	case 114: /* r: Reset user's volume level */
-		if (user)
-			reset_volumes(user);
-		else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		reset_volumes(user);
 		break;
 	case 85: /* U: Raise user's listen volume */
-		if (user)
-			tweak_listen_volume(user, VOL_UP);
-		else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		tweak_listen_volume(user, VOL_UP);
 		break;
 	case 117: /* u: Lower user's listen volume */
-		if (user)
-			tweak_listen_volume(user, VOL_DOWN);
-		else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		tweak_listen_volume(user, VOL_DOWN);
 		break;
 	case 84: /* T: Raise user's talk volume */
-		if (user)
-			tweak_talk_volume(user, VOL_UP);
-		else
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		tweak_talk_volume(user, VOL_UP);
 		break;
 	case 116: /* t: Lower user's talk volume */
-		if (user) 
-			tweak_talk_volume(user, VOL_DOWN);
-		else 
-			ast_log(LOG_NOTICE, "Specified User not found!\n");
+		tweak_talk_volume(user, VOL_DOWN);
 		break;
 	}
 
+	if (args.user) {
+		/* decrement reference from find_user */
+		ao2_ref(user, -1);
+	}
+usernotfound:
 	AST_LIST_UNLOCK(&confs);
 
 	dispose_conf(cnf);
@@ -3161,9 +3263,7 @@
 		return 0;
 	}
 
-	AST_LIST_TRAVERSE(&conf->userlist, user, list)
-		if (user->user_no == userno)
-			break;
+	user = ao2_find(conf->usercontainer, &userno, 0);
 
 	if (!user) {
 		AST_LIST_UNLOCK(&confs);
@@ -3180,6 +3280,7 @@
 
 	ast_log(LOG_NOTICE, "Requested to %smute conf %s user %d userchan %s uniqueid %s\n", mute ? "" : "un", conf->confno, user->user_no, user->chan->name, user->chan->uniqueid);
 
+	ao2_ref(user, -1);
 	astman_send_ack(s, m, mute ? "User muted" : "User unmuted");
 	return 0;
 }

Modified: team/oej/deluxepine-1.4/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/apps/app_queue.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/apps/app_queue.c (original)
+++ team/oej/deluxepine-1.4/apps/app_queue.c Wed Jul 21 14:21:32 2010
@@ -574,10 +574,13 @@
 	struct member *member;
 	struct ao2_iterator mem_iter;
 	enum queue_member_status result = QUEUE_NO_MEMBERS;
+	int allpaused = 1, empty = 1;
 
 	ao2_lock(q);
 	mem_iter = ao2_iterator_init(q->members, 0);
 	while ((member = ao2_iterator_next(&mem_iter))) {
+		empty = 0;
+
 		if (max_penalty && (member->penalty > max_penalty)) {
 			ao2_ref(member, -1);
 			continue;
@@ -586,6 +589,8 @@
 		if (member->paused) {
 			ao2_ref(member, -1);
 			continue;
+		} else {
+			allpaused = 0;
 		}
 
 		switch (member->status) {
@@ -605,6 +610,10 @@
 	}
 	ao2_iterator_destroy(&mem_iter);
 	ao2_unlock(q);
+
+	if (!empty && allpaused) {
+		result = QUEUE_NO_REACHABLE_MEMBERS;
+	}
 	return result;
 }
 

Modified: team/oej/deluxepine-1.4/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/apps/app_voicemail.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/apps/app_voicemail.c (original)
+++ team/oej/deluxepine-1.4/apps/app_voicemail.c Wed Jul 21 14:21:32 2010
@@ -3544,7 +3544,7 @@
 						ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
 					}
 				} else {
-					ast_log(LOG_WARNING, "Sox failed to reencode %s.%s: %s (have you installed support for all sox file formats?)\n", attach, format,
+					ast_log(LOG_WARNING, "Sox failed to re-encode %s.%s: %s (have you installed support for all sox file formats?)\n", attach, format,
 						soxstatus == 1 ? "Problem with command line options" : "An error occurred during file processing");
 					ast_log(LOG_WARNING, "Voicemail attachment will have no volume gain.\n");
 				}
@@ -5955,12 +5955,15 @@
 			DELETE(vms->curdir, x, vms->fn, vmu);
 	}
 	ast_unlock_path(vms->curdir);
-#else
+#else /* defined(IMAP_STORAGE) */
 	if (vms->deleted) {
-		for (x=0;x < vmu->maxmsg;x++) { 
-			if (vms->deleted[x]) { 
-				if (option_debug > 2)
-					ast_log(LOG_DEBUG,"IMAP delete of %d\n",x);
+		/* Since we now expunge after each delete, deleting in reverse order
+		 * ensures that no reordering occurs between each step. */
+		for (x = vmu->maxmsg - 1; x >= 0; x--) {
+			if (vms->deleted[x]) {
+				if (option_debug > 2) {
+					ast_log(LOG_DEBUG, "IMAP delete of %d\n", x);
+				}
 				DELETE(vms->curdir, x, vms->fn, vmu);
 			}
 		}

Modified: team/oej/deluxepine-1.4/autoconf/ast_func_fork.m4
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/autoconf/ast_func_fork.m4?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/autoconf/ast_func_fork.m4 (original)
+++ team/oej/deluxepine-1.4/autoconf/ast_func_fork.m4 Wed Jul 21 14:21:32 2010
@@ -13,7 +13,7 @@
 fi
 if test "x$ac_cv_func_fork_works" = xcross; then
   case $host in
-    *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* | *-*-linux-uclibc* )
+    *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
       # Override, as these systems have only a dummy fork() stub
       ac_cv_func_fork_works=no
       ;;

Modified: team/oej/deluxepine-1.4/build_tools/cflags-devmode.xml
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/build_tools/cflags-devmode.xml?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/build_tools/cflags-devmode.xml (original)
+++ team/oej/deluxepine-1.4/build_tools/cflags-devmode.xml Wed Jul 21 14:21:32 2010
@@ -12,4 +12,6 @@
 		</member>
 		<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
 		</member>
+		<member name="TEST_FRAMEWORK" displayname="Enable Test Framework API">
+		</member>
 	</category>

Modified: team/oej/deluxepine-1.4/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_agent.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_agent.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_agent.c Wed Jul 21 14:21:32 2010
@@ -707,7 +707,12 @@
 	ast_mutex_lock(&p->lock);
 	if (p->chan && !ast_check_hangup(p->chan)) {
 		while (ast_channel_trylock(p->chan)) {
-			ast_channel_unlock(ast);
+			int res;
+			if ((res = ast_channel_unlock(ast))) {
+				ast_log(LOG_ERROR, "chan_agent bug! Channel was not locked upon entry to agent_indicate: %s\n", strerror(res));
+				ast_mutex_unlock(&p->lock);
+				return -1;
+			}
 			usleep(1);
 			ast_channel_lock(ast);
 		}

Modified: team/oej/deluxepine-1.4/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_dahdi.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_dahdi.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_dahdi.c Wed Jul 21 14:21:32 2010
@@ -3416,10 +3416,10 @@
 	case AST_OPTION_ECHOCAN:
 		cp = (char *) data;
 		if (*cp) {
-			ast_log(LOG_DEBUG, "Enabling echo cancelation on %s\n", chan->name);
+			ast_log(LOG_DEBUG, "Enabling echo cancellation on %s\n", chan->name);
 			dahdi_enable_ec(p);
 		} else {
-			ast_log(LOG_DEBUG, "Disabling echo cancelation on %s\n", chan->name);
+			ast_log(LOG_DEBUG, "Disabling echo cancellation on %s\n", chan->name);
 			dahdi_disable_ec(p);
 		}
 		break;
@@ -4399,8 +4399,12 @@
 						/* Here we have to retain the lock on both the main channel, the 3-way channel, and
 						   the private structure -- not especially easy or clean */
 						while (p->subs[SUB_THREEWAY].owner && ast_mutex_trylock(&p->subs[SUB_THREEWAY].owner->lock)) {
+							int res;
 							/* Yuck, didn't get the lock on the 3-way, gotta release everything and re-grab! */
-							ast_mutex_unlock(&p->lock);
+							if ((res = ast_mutex_unlock(&p->lock))) {
+								ast_log(LOG_ERROR, "chan_dahdi bug! '&p->lock' was not locked upon entry to 'dahdi_handle_dtmfup': %s\n", strerror(res));
+								return NULL;
+							}
 							DEADLOCK_AVOIDANCE(&ast->lock);
 							/* We can grab ast and p in that order, without worry.  We should make sure
 							   nothing seriously bad has happened though like some sort of bizarre double
@@ -5167,7 +5171,7 @@
 	
 	/* Hang up if we don't really exist */
 	if (index < 0)	{
-		ast_log(LOG_WARNING, "We dont exist?\n");
+		ast_log(LOG_WARNING, "We don't exist?\n");
 		ast_mutex_unlock(&p->lock);
 		return NULL;
 	}
@@ -7852,6 +7856,8 @@
 					return NULL;
 				}
 			}
+			tmp->outsigmod = conf->chan.outsigmod;
+
 #ifdef HAVE_PRI
 			if ((chan_sig == SIG_PRI) || (chan_sig == SIG_GR303FXOKS) || (chan_sig == SIG_GR303FXSKS)) {
 				int offset;
@@ -7966,6 +7972,8 @@
 						tmp->pri = &pris[span];
 						tmp->prioffset = offset;
 						tmp->call = NULL;
+
+						tmp->priexclusive = conf->chan.priexclusive;
 					} else {
 						ast_log(LOG_ERROR, "Channel %d is reserved for D-channel.\n", offset);
 						destroy_dahdi_pvt(&tmp);
@@ -8072,7 +8080,6 @@
 		tmp->immediate = conf->chan.immediate;
 		tmp->transfertobusy = conf->chan.transfertobusy;
 		tmp->sig = chan_sig;
-		tmp->outsigmod = conf->chan.outsigmod;
 		tmp->ringt_base = ringt_base;
 		tmp->firstradio = 0;
 		if ((chan_sig == SIG_FXOKS) || (chan_sig == SIG_FXOLS) || (chan_sig == SIG_FXOGS))
@@ -8117,7 +8124,6 @@
 		tmp->dahditrcallerid = conf->chan.dahditrcallerid;
 		tmp->restrictcid = conf->chan.restrictcid;
 		tmp->use_callingpres = conf->chan.use_callingpres;
-		tmp->priexclusive = conf->chan.priexclusive;
 		if (tmp->usedistinctiveringdetection) {
 			if (!tmp->use_callerid) {
 				ast_log(LOG_NOTICE, "Distinctive Ring detect requires 'usecallerid' be on\n");
@@ -12171,6 +12177,7 @@
 					res = ioctl(ctlfd, DAHDI_SET_DIALPARAMS, &dps);
 					if (res < 0) {
 						ast_log(LOG_ERROR, "Invalid tone duration: %d ms: %s\n", toneduration, strerror(errno));
+						close(ctlfd);
 						return -1;
 					}
 				}

Modified: team/oej/deluxepine-1.4/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_h323.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_h323.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_h323.c Wed Jul 21 14:21:32 2010
@@ -313,10 +313,8 @@
 	if (pvt) {
 		ast_mutex_lock(&pvt->lock);
 		/* Don't hold pvt lock while trying to lock the channel */
-		while(pvt->owner && ast_channel_trylock(pvt->owner)) {
-			ast_mutex_unlock(&pvt->lock);
-			usleep(1);
-			ast_mutex_lock(&pvt->lock);
+		while (pvt->owner && ast_channel_trylock(pvt->owner)) {
+			DEADLOCK_AVOIDANCE(&pvt->lock);
 		}
 
 		if (pvt->owner) {

Modified: team/oej/deluxepine-1.4/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_iax2.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_iax2.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_iax2.c Wed Jul 21 14:21:32 2010
@@ -172,6 +172,7 @@
 static struct ast_netsock_list *netsock;
 static struct ast_netsock_list *outsock;		/*!< used if sourceaddress specified and bindaddr == INADDR_ANY */
 static int defaultsockfd = -1;
+static int unloading;
 
 int (*iax2_regfunk)(const char *username, int onoff) = NULL;
 
@@ -2324,6 +2325,12 @@
 	};
 
 	if ((peercnt = ao2_find(peercnts, &tmp, OBJ_POINTER))) {
+		if (unloading) {
+			peercnt_remove_cb(peercnt);
+			replace_callno(callno_entry);
+			return;
+		}
+
 		/* refcount is incremented with ao2_find.  keep that ref for the scheduler */
 		if (option_debug) {
 			ast_log(LOG_DEBUG, "schedule decrement of callno used for %s in %d seconds\n", ast_inet_ntoa(sin->sin_addr), MIN_REUSE_TIME);
@@ -9976,12 +9983,14 @@
 	ast_atomic_fetchadd_int(&iaxactivethreadcount,1);
 	pthread_cleanup_push(iax2_process_thread_cleanup, data);
 	for(;;) {
+		pthread_testcancel();
+
 		/* Wait for something to signal us to be awake */
 		ast_mutex_lock(&thread->lock);
 
 		/* Flag that we're ready to accept signals */
 		thread->ready_for_signal = 1;
-		
+
 		/* Put into idle list if applicable */
 		if (put_into_idle)
 			insert_idle_thread(thread);
@@ -12491,8 +12500,10 @@
 	struct iax2_thread *thread = NULL;
 	int x;
 
+	unloading = 1;
+
 	/* Make sure threads do not hold shared resources when they are canceled */
-	
+
 	/* Grab the sched lock resource to keep it away from threads about to die */
 	/* Cancel the network thread, close the net socket */
 	if (netthreadid != AST_PTHREADT_NULL) {
@@ -12505,13 +12516,13 @@
 		pthread_join(netthreadid, NULL);
 	}
 	if (schedthreadid != AST_PTHREADT_NULL) {
-		ast_mutex_lock(&sched_lock);	
+		ast_mutex_lock(&sched_lock);
 		pthread_cancel(schedthreadid);
 		ast_cond_signal(&sched_cond);
-		ast_mutex_unlock(&sched_lock);	
+		ast_mutex_unlock(&sched_lock);
 		pthread_join(schedthreadid, NULL);
 	}
-	
+
 	/* Call for all threads to halt */
 	AST_LIST_LOCK(&idle_list);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&idle_list, thread, list) {
@@ -12530,19 +12541,20 @@
 	AST_LIST_UNLOCK(&active_list);
 
 	AST_LIST_LOCK(&dynamic_list);
-        AST_LIST_TRAVERSE_SAFE_BEGIN(&dynamic_list, thread, list) {
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&dynamic_list, thread, list) {
 		AST_LIST_REMOVE_CURRENT(&dynamic_list, list);
 		pthread_cancel(thread->threadid);
-        }
+	}
 	AST_LIST_TRAVERSE_SAFE_END
-        AST_LIST_UNLOCK(&dynamic_list);
+	AST_LIST_UNLOCK(&dynamic_list);
 
 	AST_LIST_HEAD_DESTROY(&iaxq.queue);
 
 	/* Wait for threads to exit */
-	while(0 < iaxactivethreadcount)
+	while (0 < iaxactivethreadcount) {
 		usleep(10000);
-	
+	}
+
 	ast_netsock_release(netsock);
 	ast_netsock_release(outsock);
 	for (x = 0; x < ARRAY_LEN(iaxs); x++) {

Modified: team/oej/deluxepine-1.4/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_local.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_local.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_local.c Wed Jul 21 14:21:32 2010
@@ -183,10 +183,18 @@
 
 	/* Ensure that we have both channels locked */
 	while (other && ast_channel_trylock(other)) {
-		ast_mutex_unlock(&p->lock);
+		int res;
+		if ((res = ast_mutex_unlock(&p->lock))) {
+			ast_log(LOG_ERROR, "chan_local bug! '&p->lock' was not locked when entering local_queue_frame! (%s)\n", strerror(res));
+			return -1;
+		}
 		if (us && us_locked) {
 			do {
-				ast_channel_unlock(us);
+				if (ast_channel_unlock(us)) {
+					ast_log(LOG_ERROR, "chan_local bug! Our channel was not locked, yet arguments indicated that it was!!\n");
+					ast_mutex_lock(&p->lock);
+					return -1;
+				}
 				usleep(1);
 				ast_channel_lock(us);
 			} while (ast_mutex_trylock(&p->lock));

Modified: team/oej/deluxepine-1.4/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_misdn.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_misdn.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_misdn.c Wed Jul 21 14:21:32 2010
@@ -5276,9 +5276,9 @@
 		"    a - Have Asterisk detect DTMF tones on called channel\n"
 		"    c - Make crypted outgoing call, optarg is keyindex\n"
 		"    d - Send display text to called phone, text is the optarg\n"
-		"    e - Perform echo cancelation on this channel,\n"
+		"    e - Perform echo cancellation on this channel,\n"
 		"        takes taps as optarg (32,64,128,256)\n"
-		"   e! - Disable echo cancelation on this channel\n"
+		"   e! - Disable echo cancellation on this channel\n"
 		"    f - Enable fax detection\n"
 		"    h - Make digital outgoing call\n"
 		"   h1 - Make HDLC mode digital outgoing call\n"

Modified: team/oej/deluxepine-1.4/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_oss.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_oss.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_oss.c Wed Jul 21 14:21:32 2010
@@ -50,6 +50,7 @@
 #include <sys/time.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>      /* for pthread_kill(3) */
 
 #ifdef __linux
 #include <linux/soundcard.h>
@@ -606,6 +607,8 @@
 		fd_set rfds, wfds;
 		int maxfd, res;
 
+		pthread_testcancel();
+
 		FD_ZERO(&rfds);
 		FD_ZERO(&wfds);
 		FD_SET(o->sndcmd[0], &rfds);
@@ -626,6 +629,7 @@
 		}
 		/* ast_select emulates linux behaviour in terms of timeout handling */
 		res = ast_select(maxfd + 1, &rfds, &wfds, NULL, NULL);
+		pthread_testcancel();
 		if (res < 1) {
 			ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno));
 			sleep(1);
@@ -636,6 +640,7 @@
 			int i, what = -1;
 
 			if (read(o->sndcmd[0], &what, sizeof(what)) != sizeof(what)) {
+				pthread_testcancel();
 				ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
 				continue;
 			}
@@ -1880,17 +1885,28 @@
 	ast_cli_unregister_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
 
 	for (o = oss_default.next; o; o = o->next) {
+		if (o->owner) {
+			ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
+			/* Give the channel a chance to go away */
+			sched_yield();
+		}
+		if (o->owner) {
+			return -1;
+		}
+		oss_default.next = o->next;
+		if (o->sthread > 0) {
+			pthread_cancel(o->sthread);
+			pthread_kill(o->sthread, SIGURG);
+			pthread_join(o->sthread, NULL);
+		}
 		close(o->sounddev);
 		if (o->sndcmd[0] > 0) {
 			close(o->sndcmd[0]);
 			close(o->sndcmd[1]);
 		}
-		if (o->owner)
-			ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
-		if (o->owner)
-			return -1;
-		/* XXX what about the thread ? */
-		/* XXX what about the memory allocated ? */
+		if (o->sthread > 0) {
+			free(o);
+		}
 	}
 	return 0;
 }

Modified: team/oej/deluxepine-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/deluxepine-1.4/channels/chan_sip.c?view=diff&rev=278558&r1=278557&r2=278558
==============================================================================
--- team/oej/deluxepine-1.4/channels/chan_sip.c (original)
+++ team/oej/deluxepine-1.4/channels/chan_sip.c Wed Jul 21 14:21:32 2010
@@ -815,11 +815,12 @@
 #define SIP_PAGE2_UDPTL_DESTINATION     (1 << 28)       /*!< 28: Use source IP of RTP as destination if NAT is enabled */
 #define SIP_PAGE2_DIALOG_ESTABLISHED    (1 << 29)       /*!< 29: Has a dialog been established? */

[... 1656 lines stripped ...]



More information about the svn-commits mailing list