[asterisk-commits] russell: trunk r58541 - in /trunk: ./ apps/app_meetme.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 8 16:21:44 MST 2007


Author: russell
Date: Thu Mar  8 17:21:44 2007
New Revision: 58541

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58541
Log:
Merged revisions 58512 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r58512 | russell | 2007-03-08 16:15:15 -0600 (Thu, 08 Mar 2007) | 5 lines

Hang up the channel that put the call on hold in the event processing thread to
avoid a race condition.  Also, if the station originated the call that it is
putting on hold, don't hang up the trunk if it was the only station on the call
and it is hanging up due to hold and not a normal hangup.

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_meetme.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=58541&r1=58540&r2=58541
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Thu Mar  8 17:21:44 2007
@@ -1301,9 +1301,6 @@
 		ast_log(LOG_DEBUG, "Trunk not found for event!\n");
 		return;
 	}
-
-	ast_softhangup(chan, AST_CAUSE_NORMAL);
-	trunk_ref->chan = NULL;
 
 	sla_queue_event_full(type, trunk_ref, station, 1);
 }
@@ -3674,6 +3671,9 @@
 		event->station->name, event->trunk_ref->trunk->name);
 	sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD, 
 		INACTIVE_TRUNK_REFS, event->trunk_ref);
+	
+	ast_softhangup(event->trunk_ref->chan, AST_CAUSE_NORMAL);
+	event->trunk_ref->chan = NULL;
 }
 
 /*! \brief Process trunk ring timeouts
@@ -4039,7 +4039,6 @@
 	struct sla_station *station;
 	struct sla_trunk_ref *trunk_ref = NULL;
 	char conf_name[MAX_CONFNUM];
-	int res;
 	struct ast_flags conf_flags = { 0 };
 	struct ast_conference *conf;
 
@@ -4146,8 +4145,8 @@
 		conf = NULL;
 	}
 	trunk_ref->chan = NULL;
-	res = ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, -1);
-	if (res == 1) {	
+	if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
+		!trunk_ref->trunk->hold_stations) {
 		strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1);
 		admin_exec(NULL, conf_name);
 		sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);



More information about the asterisk-commits mailing list