Merged revisions 53035 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Wed, 31 Jan 2007 17:35:14 +0000 (17:35 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 31 Jan 2007 17:35:14 +0000 (17:35 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r53035 | russell | 2007-01-31 11:34:22 -0600 (Wed, 31 Jan 2007) | 4 lines

Instead of always creating a realtime queue member as unpaused, read the
"paused" column and use that value for the paused status of the member.
(issue #8949, jmls)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@53036 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index a692d15..c8a9dc6 100644 (file)
@@ -956,10 +956,11 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
        }
 }
 
-static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str)
+static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str, const char *paused_str)
 {
        struct member *m, *prev_m;
        int penalty = 0;
+       int paused  = 0;
 
        if (penalty_str) {
                penalty = atoi(penalty_str);
@@ -967,6 +968,12 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
                        penalty = 0;
        }
 
+       if (paused_str) {
+               paused = atoi(paused_str);
+               if (paused < 0)
+                       paused = 0;
+       }
+
        /* Find the member, or the place to put a new one. */
        for (m = q->members, prev_m = NULL;
                m && strcmp(m->interface, interface);
@@ -974,7 +981,7 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
 
        /* Create a new one if not found, else update penalty */
        if (!m) {
-               if ((m = create_queue_member(interface, membername, penalty, 0))) {
+               if ((m = create_queue_member(interface, membername, penalty, paused))) {
                        m->dead = 0;
                        add_to_interfaces(interface);
                        if (prev_m) {
@@ -985,6 +992,7 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
                }
        } else {
                m->dead = 0;    /* Do not delete this one. */
+               m->paused = paused;
                m->penalty = penalty;
        }
 }
@@ -1106,7 +1114,8 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
        while ((interface = ast_category_browse(member_config, interface))) {
                rt_handle_member_record(q, interface,
                        S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
-                       ast_variable_retrieve(member_config, interface, "penalty"));
+                       ast_variable_retrieve(member_config, interface, "penalty"),
+                       ast_variable_retrieve(member_config, interface, "paused"));
        }
 
        /* Delete all realtime members that have been deleted in DB. */