aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_musiconhold.c')
-rwxr-xr-xres/res_musiconhold.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index df018b429..3b8c5b098 100755
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -962,10 +962,11 @@ static void ast_moh_destroy(void)
ast_mutex_unlock(&moh_lock);
}
-static void moh_on_off(int on) {
- struct ast_channel *chan = ast_channel_walk_locked(NULL);
+static void moh_on_off(int on)
+{
+ struct ast_channel *chan = NULL;
- while (chan) {
+ while ( (chan = ast_channel_walk_locked(chan)) != NULL) {
if (ast_test_flag(chan, AST_FLAG_MOH)) {
if (on)
local_ast_moh_start(chan, NULL);
@@ -973,7 +974,6 @@ static void moh_on_off(int on) {
ast_deactivate_generator(chan);
}
ast_mutex_unlock(&chan->lock);
- chan = ast_channel_walk_locked(chan);
}
}