aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_meetme.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-08 22:15:15 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-08 22:15:15 +0000
commitb8bd81eeab8fac0e55b145f1ca781d092fd78483 (patch)
treeb7e998dcd7aa8c2e308cbd29aaab89f209d91e6d /apps/app_meetme.c
parent1a5d04b3608cc7cd277dd9d1632ff4b58f74985f (diff)
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. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@58512 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_meetme.c')
-rw-r--r--apps/app_meetme.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 1fe4864df..0d4d193d9 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -1304,9 +1304,6 @@ static void sla_queue_event_conf(enum sla_event_type type, struct ast_channel *c
return;
}
- ast_softhangup(chan, AST_CAUSE_NORMAL);
- trunk_ref->chan = NULL;
-
sla_queue_event_full(type, trunk_ref, station, 1);
}
@@ -3664,6 +3661,9 @@ static void sla_handle_hold_event(struct sla_event *event)
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
@@ -4029,7 +4029,6 @@ static int sla_station_exec(struct ast_channel *chan, void *data)
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;
@@ -4136,8 +4135,8 @@ static int sla_station_exec(struct ast_channel *chan, void *data)
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);