Pause queue members, when Asterisk starts

I would like to keep a SIP peer in some queues, but in a paused state.

I need this user in this queues because there is a software, built on top of Asterisk (via AMI), that check queue members and show to the user “things” related to him. At the same time, I don’t want this user to ring at any queue call.

So I put this member in all queues and paused him from the queues he doesn’t want to ring in.
I know, it’s not a great solutions, but it works.

My problem is that if the server would be restarted, I have to pause this user again. There is any way to perform some actions when Asterisk starts? I want to pause the peer in some of its queues, when Asterisk starts

Thank you in advance for the help

Do you have persistent members set on the queue?

If you have, it might be related to this bug https://issues.asterisk.org/jira/browse/ASTERISK-22546 which wasn’t fixed last I checked.

After pausing the member, just do some other action to the queue, like add and remove a random member, and see if that helps. I have no issues with members loosing pause state on restart of asterisk, on the servers I run.

1 Like

Thank you Chano :-), that would be a great solution, but I can’t use dynamic queue members.

The software I use (build by the company I work for) handles only static queue members.
Although dynamic persistent members feature would keep the member in the queue, I can’t use this feature because with the software I use it would be useless.

Maybe a quick and dirty way could be to pause the queue members with a command “asterisk -rx XXX” using systemd via ExecStartPost in the .service file but I don’t know is there is a better way to achieve what I need (leave systemd out would be better).

Maybe there is some hook provided by Asterisk? Something like “PostStart” where I can exec some commands? In the manual I don’t find anything.

Thank you for your time

Although all this seems to be abusing the queue mechanism if you never want to all them from the queue, put them in with a higher penalty than the maximum for the queue

all this seems to be abusing the queue mechanism

yes, that’s completely true :frowning:

The fact is that I can’t edit the software and I can’t say “no” because our customer is already angry to us (for other reasons that we can’t handle). I want him to be happy so I’m looking for some even crappy solution that does the job. It’s really a sad situation.

The penalty, as you suggested, isn’t a viable solution because it’s very likely that someone will not answer the phone, making the peer of this guy ring when he doesn’t want.

Thank you for the help

I was thinking of:

However, in searching for this, I found:

which might also help.

1 Like

you can run this command on cron @reboot

queue {pause|unpause} member – Pause or unpause a queue member

How do you ensure it’s only run AFTER asterisk has started?

These are great options! I should have checked the queues.conf.sample more carefully.

I’ll try them out on my testing PBX.
Then I will update the topic with the results.

Thank you :slight_smile:

The problem is that ensuring the command runs only after Asterisk has started can be challenging (as Chano pointed out). Also, if for some reason Asterisk restarts (only Asterisk, not the server) the command wouldn’t be executed.

Thank you anyway :slight_smile:

Ok, I’ve tried your options and the result are “interesting” (unfortunately :frowning: ).

Both when I set the penalty over the QUEUE_MAX_PENALTY and when I set the penalty to a negative value (with negative_penalty_invalid = yes) the same thing happens:

if I ran queue show I see that the member has not penalty:

Normal Man (SIP/xxx1) with penalty 1 (ringinuse disabled) (Not in use) has taken no calls yet
**No Ring Man (SIP/xxx2) (ringinuse disabled) (Not in use) has taken no calls yet**
Normal Man (SIP/xxx3) with penalty 1 (ringinuse disabled) (Not in use) has taken no calls yet
Normal Man (SIP/xxx4) with penalty 1 (ringinuse disabled) (Not in use) has taken no calls yet

Calling the queue I see that changing the penalty (both over QUEUE_MAX_PENALTY and negative value) has the opposite effect: the No Ring Man is always the first to ring!

If I set the penalty to something like 2, everything works as expected (who has penalty 1 rings before, the guy with penalty 2 rings after).

Asterisk version is: Asterisk certified/13.18-cert2

Playing with penalty doesn’t seem to be a viable solution so :frowning:

Sorry I misread it was only when asterisk is restarted. In this case would try modifying the Asterisk’s start stop & script to run the command

1 Like

Tried with ExecStartPost, via systemd .serivce file, but without success.

At the end, I gave up.
I tried everything for make my customer happy but I can’t do miracles.

A big thank you to all of you who helped me. :slightly_smiling_face:

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