[asterisk-commits] russell: branch russell/sla_rewrite r52334 - /team/russell/sla_rewrite/apps/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jan 26 16:24:31 MST 2007


Author: russell
Date: Fri Jan 26 17:24:31 2007
New Revision: 52334

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52334
Log:
The trunk pointer must be saved locally on the dial_trunk thread's stack,
because once the station's thread gets signalled back that the conf is up,
the args struct passed to the thread will no longer be valid.

Modified:
    team/russell/sla_rewrite/apps/app_meetme.c

Modified: team/russell/sla_rewrite/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_rewrite/apps/app_meetme.c?view=diff&rev=52334&r1=52333&r2=52334
==============================================================================
--- team/russell/sla_rewrite/apps/app_meetme.c (original)
+++ team/russell/sla_rewrite/apps/app_meetme.c Fri Jan 26 17:24:31 2007
@@ -2830,6 +2830,7 @@
 	char conf_name[MAX_CONFNUM];
 	struct ast_conference *conf;
 	struct ast_flags conf_flags = { 0 };
+	struct sla_trunk *trunk = args->trunk;
 
 	if (!(dial = ast_dial_create())) {
 		ast_mutex_lock(args->cond_lock);
@@ -2838,7 +2839,7 @@
 		return NULL;
 	}
 
-	tech_data = ast_strdupa(args->trunk->device);
+	tech_data = ast_strdupa(trunk->device);
 	tech = strsep(&tech_data, "/");
 	if (ast_dial_append(dial, tech, tech_data) == -1) {
 		ast_mutex_lock(args->cond_lock);
@@ -2861,8 +2862,7 @@
 		unsigned int done = 0;
 		switch ((dial_res = ast_dial_status(dial))) {
 		case AST_DIAL_RESULT_ANSWERED:
-			args->trunk->chan = ast_dial_answered(dial);
-			ast_log(LOG_DEBUG, "chan %lx\n", (long) args->trunk->chan);
+			trunk->chan = ast_dial_answered(dial);
 		case AST_DIAL_RESULT_HANGUP:
 		case AST_DIAL_RESULT_INVALID:
 		case AST_DIAL_RESULT_FAILED:
@@ -2875,13 +2875,11 @@
 		case AST_DIAL_RESULT_PROCEEDING:
 			break;
 		}
-		if (done) {
-			ast_log(LOG_DEBUG, "done with dial_res %d\n", dial_res);
+		if (done)
 			break;
-		}
-	}
-
-	if (!args->trunk->chan) {
+	}
+
+	if (!trunk->chan) {
 		ast_mutex_lock(args->cond_lock);
 		ast_cond_signal(args->cond);
 		ast_mutex_unlock(args->cond_lock);
@@ -2891,7 +2889,7 @@
 		return NULL;
 	}
 
-	snprintf(conf_name, sizeof(conf_name), "SLA_%s", args->trunk->name);
+	snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk->name);
 	ast_set_flag(&conf_flags, CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_MARKEDUSER);
 	conf = build_conf(conf_name, "", "", 1, 1, 1);
 
@@ -2900,9 +2898,9 @@
 	ast_mutex_unlock(args->cond_lock);
 
 	if (conf)
-		conf_run(args->trunk->chan, conf, conf_flags.flags, NULL);
-
-	args->trunk->chan = NULL;
+		conf_run(trunk->chan, conf, conf_flags.flags, NULL);
+
+	trunk->chan = NULL;
 
 	ast_dial_join(dial);
 	ast_dial_destroy(dial);



More information about the asterisk-commits mailing list