Fix music on hold on park
[asterisk/asterisk.git] / apps / app_queue.c
index 7f74820..9d451d1 100755 (executable)
@@ -718,9 +718,10 @@ static int queue_exec(struct ast_channel *chan, void *data)
                        }
                }
                /* Don't allow return code > 0 */
-               if (res > 0)
+               if (res > 0 && res != AST_PBX_KEEPALIVE) {
                        res = 0;        
-               ast_moh_stop(chan);
+                       ast_moh_stop(chan);
+               }
                leave_queue(&qe);
        } else {
                ast_log(LOG_WARNING, "Unable to join queue '%s'\n", queuename);
@@ -767,6 +768,7 @@ static void reload_queues(void)
                                if (q) {
                                        /* Initialize it */
                                        memset(q, 0, sizeof(struct ast_call_queue));
+                                       ast_pthread_mutex_init(&q->lock);
                                        strncpy(q->name, cat, sizeof(q->name));
                                        new = 1;
                                } else new = 0;
@@ -839,6 +841,7 @@ static void reload_queues(void)
                }
                cat = ast_category_browse(cfg, cat);
        }
+       ast_destroy(cfg);
        q = queues;
        ql = NULL;
        while(q) {