# Realtime Queue Seemingly Not Following Queue Rules

**URL:** <https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552>\
**Category:** Asterisk Support\
**Created:** [November 10, 2023, 11:29am UTC](https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552 "2023-11-10T11:29:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@Liam](https://community.asterisk.org/u/Liam)\
**Post date:** [November 10, 2023, 11:29am UTC](https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552/1 "2023-11-10T11:29:39Z")

</div>

System: Asterisk 20  
Database: MariaDB

I’m trying to give certain queue members priority using the ringall strategy and penalties.  
Example:  
Queue has two members, A and B.  
A has a penalty of 0.  
B has a penalty of 10.  
When someone calls I first want A to ring and if they time out after some time, 10 seconds for instance, I want it to stop ringing A and start ringing B.  
I believe this would result in the same behavior as using the linear strategy but that strategy doesn’t seem to work nicely with realtime. If it does and I should simply consider switching to it I’d love to hear it too.

From what I understand I should have the QUEUE\_MIN\_PENALTY and QUEUE\_MAX\_PENALTY both at 0 at the start and change them to both be 10 after time has passed.

The configuration that I’m using to try and achieve this:  
Queue in database:

```auto
| name | timeout | ringinuse | announce_frequency | announce_position | strategy | joinempty | leavewhenempty | defaultrule |

| queue | 10 | no | 60 | yes | ringall | strict | strict | myrule |

```

The queue has been verified to work when I’m not trying to use penalties

Queuerules.conf

```auto
[myrule]
penaltychange =>30,10,10

```

Dialplan:

```auto
exten => _X,1,Answer(PJSIP/SoftPhoneMobile)
same => n, Set(QUEUE_MAX_PENALTY=0)
same => n, Set(QUEUE_MIN_PENALTY=0)
exten => 8,4,Queue(queue)

```

Using queue show queue I get the following:

```auto
queue show queue
queue has 0 calls (max unlimited) in 'ringall' strategy (66s holdtime, 1s talktime), W:0, C:66, A:3, SL:0.0%, SL2:1.4% within 0s
   Members: 
      PJSIP/direct with penalty 10 (ringinuse disabled) (dynamic) (Not in use) has taken 4 calls (last was 6302 secs ago) (login was 70543 secs ago)
      PJSIP/queue (ringinuse disabled) (dynamic) (Not in use) has taken 10 calls (last was 317 secs ago) (login was 70572 secs ago)
   No Callers

```

So the penalty for “direct” (B in the example) was applied correctly

And when I do queue show rules:

```auto
queue show rules
Rule: myrule
        After 30 seconds, adjust QUEUE_MAX_PENALTY to 10, adjust QUEUE_MIN_PENALTY to 10 and adjust QUEUE_RAISE_PENALTY by 0

```

So the “myrule” rule has been parsed correctly and I don’t overrule it (default for the queue) in the dialplan.

When I try to call I see all dialplan steps happened in CLI but I never see any console output that the rule takes effect. Should I have seen this?

I’m probably missing something very simple but I don’t see it. Could someone please explain what I’m missing?

---

<div class="post-metadata">

**Author:** ![Liam](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@Liam](https://community.asterisk.org/u/Liam)\
**Post date:** [November 14, 2023, 12:52pm UTC](https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552/2 "2023-11-14T12:52:24Z")

</div>

I decided not to touch Asterisk for a couple of days and now it works without changing anything. Maybe real time queue changes aren’t very real time?

---

<div class="post-metadata">

**Author:** ![benphone](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/benphone/32/8706_2.png) [@benphone](https://community.asterisk.org/u/benphone)\
**Post date:** [November 14, 2023, 4:31pm UTC](https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552/3 "2023-11-14T16:31:21Z")

</div>

> [@Liam](#):
>
> all I see all dialplan steps happened in CLI but I never see any console output that the rule takes effect. Should I have seen this?
> 
> I’m probably missing something very simple but I don’t see it. Could someone please explain what I

you should be calling the queue with the rule  
[http://www.asteriskdocs.org/en/3rd\_Edition/asterisk-book-html-chunk/ACD\_id288932.html](http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/ACD_id288932.html)

---

<div class="post-metadata">

**Author:** ![Liam](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@Liam](https://community.asterisk.org/u/Liam)\
**Post date:** [November 17, 2023, 7:34am UTC](https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552/4 "2023-11-17T07:34:11Z")

</div>

Hi Benphone,  
Thanks for the reply, I tried that as well at some point which didn’t seem to work but I’ll try again if it stops working. Should I also do that when a default rule is set in the database? I’d assume that if a default rule is set you shouldn’t have to call the same rule in dialplan. If I should still call it in dialplan, what is the default rule field actually meant for?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [December 17, 2023, 7:34am UTC](https://community.asterisk.org/t/realtime-queue-seemingly-not-following-queue-rules/99552/5 "2023-12-17T07:34:37Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
