[svn-commits] jpeeler: branch jpeeler/bug13173 r151867 - /team/jpeeler/bug13173/apps/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 23 18:35:22 CDT 2008


Author: jpeeler
Date: Thu Oct 23 18:35:21 2008
New Revision: 151867

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151867
Log:
This allows the announce_thread to finish in a clean cancelable state. It is possible currently though that if the conference is stopped (everybody hangs up) while still attempting to play joining announcements, that notices about unknown event on the timer for the conf will be displayed. Will work on that next.

Modified:
    team/jpeeler/bug13173/apps/app_meetme.c

Modified: team/jpeeler/bug13173/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/bug13173/apps/app_meetme.c?view=diff&rev=151867&r1=151866&r2=151867
==============================================================================
--- team/jpeeler/bug13173/apps/app_meetme.c (original)
+++ team/jpeeler/bug13173/apps/app_meetme.c Thu Oct 23 18:35:21 2008
@@ -1270,9 +1270,9 @@
 			ast_translator_free_path(conf->transpath[x]);
 	}
 	if (conf->announcethread != AST_PTHREADT_NULL) {
+		ast_softhangup(conf->chan, AST_SOFTHANGUP_EXPLICIT);
 		pthread_cancel(conf->announcethread);
 		pthread_join(conf->announcethread, NULL);
-		ast_clear_flag(conf->chan, AST_FLAG_BLOCKING); /* jpeeler: this doesn't seem ideal */
 		while ((item = AST_LIST_REMOVE_HEAD(&conf->announcelist, list))) {
 			free(item);
 		}
@@ -1399,6 +1399,7 @@
 {
 	struct announce_listitem *next, *current;
 	struct ast_conference *conf = data;
+	int res;
 
 	for (;;) {
 		AST_LIST_LOCK(&conf->announcelist);
@@ -1408,16 +1409,18 @@
 		AST_LIST_UNLOCK(&conf->announcelist);
 
 		while ((current = next)) {
+			pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 
 			if (ast_fileexists(current->namerecloc, NULL, NULL)) {
-				if ((current->confchan) && (current->confusers > 1)) {
+				if ((current->confchan) && (current->confusers > 1) && !ast_check_hangup(current->confchan)) {
 					if (!ast_streamfile(current->confchan, current->namerecloc, current->language))
-						ast_waitstream(current->confchan, "");
-					if (!ast_streamfile(current->confchan, "conf-hasleft", current->language))
-						ast_waitstream(current->confchan, "");
+						res = ast_waitstream(current->confchan, "");
+					if (!res) {
+						if (!ast_streamfile(current->confchan, "conf-hasleft", current->language))
+							ast_waitstream(current->confchan, "");
+					}
 				}
 				ast_filedelete(current->namerecloc, NULL);
 			}
-			pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 
 			next = AST_LIST_NEXT(current, list);
 			AST_LIST_REMOVE_HEAD(&conf->announcelist, list);
 			free(current);




More information about the svn-commits mailing list