[svn-commits] russell: branch russell/sla_rewrite r53690 -
/team/russell/sla_rewrite/apps/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Thu Feb 8 17:17:03 MST 2007
Author: russell
Date: Thu Feb 8 18:17:02 2007
New Revision: 53690
URL: http://svn.digium.com/view/asterisk?view=rev&rev=53690
Log:
Fix an issue with blinky lights and HOLD.
When a station puts the trunk on hold, all of the other stations that are not
on a call should show it as on hold.
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=53690&r1=53689&r2=53690
==============================================================================
--- team/russell/sla_rewrite/apps/app_meetme.c (original)
+++ team/russell/sla_rewrite/apps/app_meetme.c Thu Feb 8 18:17:02 2007
@@ -2953,7 +2953,7 @@
return station_ref;
}
-static void change_trunk_state(const struct sla_trunk *trunk, enum sla_trunk_state state)
+static void change_trunk_state(const struct sla_trunk *trunk, enum sla_trunk_state state, int inactive_only)
{
struct sla_station *station;
struct sla_trunk_ref *trunk_ref;
@@ -2962,7 +2962,7 @@
AST_LIST_TRAVERSE(&sla_stations, station, entry) {
AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
- if (trunk_ref->trunk != trunk)
+ if (trunk_ref->trunk != trunk || (inactive_only ? station->chan : 0))
continue;
trunk_ref->state = state;
ast_device_state_changed("SLA:%s_%s", station->name, trunk->name);
@@ -3008,7 +3008,7 @@
if (ast_atomic_dec_and_test((int *) &trunk->active_stations)) {
strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1);
admin_exec(NULL, conf_name);
- change_trunk_state(trunk, SLA_TRUNK_STATE_IDLE);
+ change_trunk_state(trunk, SLA_TRUNK_STATE_IDLE, 0);
}
return NULL;
@@ -3048,12 +3048,13 @@
event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD;
ast_device_state_changed("SLA:%s_%s",
event->station->name, event->trunk_ref->trunk->name);
+ change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD, 1);
break;
case SLA_EVENT_UNHOLD:
ast_log(LOG_DEBUG, "UNHOLD, station: %s trunk: %s\n",
event->station->name, event->trunk_ref->trunk->name);
if (ast_atomic_dec_and_test((int *) &event->trunk_ref->trunk->hold_stations) == 1)
- change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_UP);
+ change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_UP, 0);
else {
event->trunk_ref->state = SLA_TRUNK_STATE_UP;
ast_device_state_changed("SLA:%s_%s",
@@ -3130,7 +3131,6 @@
pthread_t dont_care;
ast_mutex_t cond_lock;
ast_cond_t cond;
- unsigned int done = 0;
switch ((dial_res = ast_dial_status(station_ref->station->dial))) {
case AST_DIAL_RESULT_HANGUP:
@@ -3167,7 +3167,7 @@
break;
}
ast_answer(trunk_ref->trunk->chan);
- change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP);
+ change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, 0);
args.trunk = trunk_ref->trunk;
args.station = station_ref->station;
args.cond = &cond;
@@ -3192,13 +3192,7 @@
case AST_DIAL_RESULT_PROCEEDING:
break;
}
- if (dial_res == AST_DIAL_RESULT_ANSWERED)
- break;
- ast_mutex_lock(&sla.lock);
- if (!AST_LIST_EMPTY(&sla.event_q))
- done = 1;
- ast_mutex_unlock(&sla.lock);
- if (done)
+ if (dial_res == AST_DIAL_RESULT_ANSWERED || !AST_LIST_EMPTY(&sla.event_q))
break;
}
AST_LIST_TRAVERSE_SAFE_END
@@ -3394,7 +3388,7 @@
.cond_lock = &cond_lock,
.cond = &cond,
};
- change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP);
+ change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, 0);
/* Create a thread to dial the trunk and dump it into the conference.
* However, we want to wait until the trunk has been dialed and the
* conference is created before continuing on here. */
@@ -3414,7 +3408,7 @@
if (!trunk_ref->trunk->chan) {
ast_log(LOG_DEBUG, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan);
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION");
- change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE);
+ change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, 0);
return 0;
}
}
@@ -3433,7 +3427,7 @@
if (res == 1) {
strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1);
admin_exec(NULL, conf_name);
- change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE);
+ change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, 0);
}
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "SUCCESS");
@@ -3485,7 +3479,7 @@
return 0;
}
- change_trunk_state(trunk, SLA_TRUNK_STATE_RINGING);
+ change_trunk_state(trunk, SLA_TRUNK_STATE_RINGING, 0);
ast_mutex_lock(&sla.lock);
if (AST_LIST_EMPTY(&sla.ringing_trunks))
More information about the svn-commits
mailing list