Summary:ASTERISK-13179: app_queue does not update on realtime update
Reporter:Cristian Dimache (cristiandimache)Labels:
Date Opened:2008-12-08 17:33:59.000-0600Date Closed:2008-12-15 11:05:57.000-0600
Versions:Frequency of
Environment:Attachments:( 0) update_strategy_queue_realtime.diff.txt
Description:We use app_queue with realtime MySQL. We want to set a different strategy, so we change the content of the MySQL table to reflect this.
However, the change is not reflected in app_queue unless Asterisk is restarted.


Using Asterisk 1.6.03-rc1
Steps to reproduce:
- add a queue
- issue a queue show
- change something in the queue
- issue a queue show again. Nothing changes.

I can see that the MySQL queries are performed Ok.
Comments:By: Terry Wilson (twilson) 2008-12-10 16:17:04.000-0600

cristiandimache: I *think* the attached patch will take care of it for you.  I don't have realtime queues set up right now, so I can't test it, but, if you could test it for me and let me know if it fixes your issue I would appreciate it.  Cut & pasting the output of the "wget patch" link while in your asterisk build directory should apply the patch.

By: Cristian Dimache (cristiandimache) 2008-12-12 05:51:25.000-0600

Tested, works Ok! Thanks!

By: Digium Subversion (svnbot) 2008-12-12 17:48:40.000-0600

Repository: asterisk
Revision: 163873

U   trunk/apps/app_queue.c

r163873 | twilson | 2008-12-12 17:48:39 -0600 (Fri, 12 Dec 2008) | 6 lines

When using realtime queues, app_queue wasn't updating the strategy if it was changed in the realtime backend.  This patch resolves the issue for almost all situations.  It is currently not supported to switch to the linear strategy via realtime since the ao2_container for members will have been set to have multiple buckets and therefore the members would be unordered.

(closes issue ASTERISK-13179)
Reported by: cristiandimache
Tested by: otherwiseguy, cristiandimache



By: Cristian Dimache (cristiandimache) 2008-12-13 03:44:15.000-0600

Just as a question, I noticed that, if you set the "strategy" field in the database to NULL, the change is not reflected in Asterisk.
Shouldn't Asterisk revert to the defaults (ringall) on such a change?

By: Terry Wilson (twilson) 2008-12-15 11:05:56.000-0600

On a change to NULL?  Personally, I would say that if anyone is changing to NULL (as opposed to it being NULL to begin with) and expecting a behavior, then they should wet up the DB with the field NOT NULL with a default to whatever they want to happen.  I don't think there is an easy way to change the queue to get the behavior on it being set to NULL, so I'm going to close this with the above workaround as my suggestion to fixing.