app_queue.c: Fix clearing of pause reason string.
authorRichard Mudgett <rmudgett@digium.com>
Wed, 12 Oct 2016 22:27:06 +0000 (17:27 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 13 Oct 2016 20:56:53 +0000 (15:56 -0500)
The pause reason is not always cleared when it should be cleared.

* Made set_queue_member_pause() always clear pause reason if not pausing
with a reason string.

Change-Id: I993dad19626ec017478a230e980989438b778c53

apps/app_queue.c

index a023b88..34c0131 100644 (file)
@@ -7232,12 +7232,12 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
 
        mem->paused = paused;
        if (paused) {
-               if (!ast_strlen_zero(reason)) {
-                       ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
-               }
                time(&mem->lastpause); /* update last pause field */
+       }
+       if (paused && !ast_strlen_zero(reason)) {
+               ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
        } else {
-               ast_copy_string(mem->reason_paused, "", sizeof(mem->reason_paused));
+               mem->reason_paused[0] = '\0';
        }
 
        ast_devstate_changed(mem->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,