Summary:ASTERISK-17137: [patch] New manager Action: QueueSync
Reporter:Gabriel Ortiz Lour (elbriga)Labels:patch
Date Opened:2011-01-18 19:42:11.000-0600Date Closed:
Versions:Frequency of
Environment:Attachments:( 0) app_queue-QueueSync.diff
( 1) app_queue-QueueSync-2.diff
( 2) app_queue-QueueSync-3.diff
( 3) app_queue-QueueSync-trunk.diff
Description:I've had some problems with the time that took to login agents via AMI, since I had to first make sure they're removed from all queues first, and then I've QueueAdd them to the Queues they belong.

 With this code in I can send an AMI command like this:

Action: QueueSync
Queues: queue1,queue5,queue7
Interface: SIP/pa01
Paused: 0
MemberName: Agent01

 And that will make sure that Agent01 gets added to the queues listed (queue1,queue5,queue7) AND removed from all the other queues, with just one AMI command.

 It will silently ignore errors such as "Already There", thus the only possible error that it can cause is an RES_OUTOFMEMORY error.


Already on the reviewboard with same info
(didn't knew if I should post on both reviewboard and here... )
Comments:By: Jamuel Starkey (jamuel) 2011-01-18 23:23:22.000-0600

It would be nice if there was an optional switch to *not* remove the agent from queues not mentioned in the Queues parameter.  Does this seem like a relatively trivial addition?

Action: QueueSync
Queues: queue1,queue5,queue7
Interface: SIP/pa01
Paused: 0
MemberName: Agent01
DoNotRemove: 1

By: Gabriel Ortiz Lour (elbriga) 2011-01-19 17:48:19.000-0600

Yes, and if the param "DoNotRemove" is missing or is "0" it will do the removing.

Sounds good. I'll make the change.

By: Gabriel Ortiz Lour (elbriga) 2011-01-19 18:03:28.000-0600

Done. param "DoNotRemove" added on the patch: app_queue-QueueSync-2.diff

By: Gabriel Ortiz Lour (elbriga) 2011-01-20 19:04:50.000-0600

the latest patch is against trunk (app_queue.c rev 303011)

By: Gabriel Ortiz Lour (elbriga) 2011-01-20 19:14:56.000-0600

the diff # 3 is because when doing the patch for the trunk version I had a crash with a while that was in the code. Changing the "while" with a more controled "for" did the trick.

By: Rafael Prado Rocchi (prado) 2011-11-21 01:37:59.852-0600

I just started doing some heavy tests here.... feedback later. Thanks for the code.

By: Dan Jenkins (danjenkins) 2012-02-17 11:20:06.172-0600

This is something that I would really love to have within Asterisk, would really help me out with how I'm about to implement adding agents to a system dynamically. Is there any update on this?

By: Gabriel Ortiz Lour (elbriga) 2012-02-17 12:10:15.606-0600

I have this function in production against the version running OK for long time now.

By: Dan Jenkins (danjenkins) 2012-04-10 04:43:24.607-0500

Rafael, where did you get up to on this improvement? This would be a great addition to Asterisk and the AMI