]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 373300 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Fri, 21 Sep 2012 15:23:06 +0000 (15:23 +0000)
committerAutomerge script <automerge@asterisk.org>
Fri, 21 Sep 2012 15:23:06 +0000 (15:23 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r373300 | jrose | 2012-09-21 10:07:38 -0500 (Fri, 21 Sep 2012) | 12 lines

  app_queue: Make queue reload members and variants of that work

  Prior to this patch, 'queue reload members' cli command did not
  work at all. This also affects the manager function 'QueueReload'
  when supplied with the 'members: yes' field.

  (closes issue AST-956)
  Reported by: John Bigelow
  ........

  Merged revisions 373298 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10-digiumphones@373316 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index f043ad0d420b76bc2c5358f1015c06e84fcff209..26f5fbe57966c19a2fe1fe3f5ee5dcc560e5c11c 100644 (file)
@@ -7060,6 +7060,7 @@ static void reload_single_queue(struct ast_config *cfg, struct ast_flags *mask,
        }
        if (member_reload) {
                ao2_callback(q->members, OBJ_NODATA, mark_member_dead, NULL);
+               q->found = 1;
        }
        for (var = ast_variable_browse(cfg, queuename); var; var = var->next) {
                if (member_reload && !strcasecmp(var->name, "member")) {
@@ -7091,6 +7092,17 @@ static void reload_single_queue(struct ast_config *cfg, struct ast_flags *mask,
        queue_t_unref(q, "Expiring creation reference");
 }
 
+static int remove_members_and_mark_unfound(void *obj, void *arg, int flags)
+{
+       struct call_queue *q = obj;
+       char *queuename = arg;
+       if (!q->realtime && (ast_strlen_zero(queuename) || !strcasecmp(queuename, q->name))) {
+               q->found = 0;
+
+       }
+       return 0;
+}
+
 static int mark_dead_and_unfound(void *obj, void *arg, int flags)
 {
        struct call_queue *q = obj;
@@ -7131,6 +7143,7 @@ static int reload_queues(int reload, struct ast_flags *mask, const char *queuena
        char *cat;
        struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
        const int queue_reload = ast_test_flag(mask, QUEUE_RELOAD_PARAMETERS);
+       const int member_reload = ast_test_flag(mask, QUEUE_RELOAD_MEMBER);
 
        if (!(cfg = ast_config_load("queues.conf", config_flags))) {
                ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n");
@@ -7152,6 +7165,10 @@ static int reload_queues(int reload, struct ast_flags *mask, const char *queuena
                ao2_callback(queues, OBJ_NODATA | OBJ_NOLOCK, mark_dead_and_unfound, (char *) queuename);
        }
 
+       if (member_reload) {
+               ao2_callback(queues, OBJ_NODATA, remove_members_and_mark_unfound, (char *) queuename);
+       }
+
        /* Chug through config file */
        cat = NULL;
        while ((cat = ast_category_browse(cfg, cat)) ) {