AgentsAction

Nov 29, 2013 at 12:01 PM
I'm trying to get a list of the agents, but so far, the only response I'm getting is "Agents will follow", without anything following. Am I missing any extra step??
Here's what I have so far
public void getAgents()
        {
            if (astCon.IsConnected())
            {
                ManagerResponse response = astCon.SendAction(new AgentsAction());
                if (response.IsSuccess())
                {
                    Debug.Print(response.Message.ToString()); //Which prints "Agents will follow"
                }
            }
        }
Nov 30, 2013 at 12:03 PM
Yes, you need to look for the AgentsEvent. If you want to run this "inline" i.e. not wait for the events, then maybe you need to look more at the following examples: -

(This is form AsterNET.Test application, and in this specific case applies to Queues, not agents, but you can simply modify it)
try
            {
                re = manager.SendEventGeneratingAction(new QueueStatusAction());
            }
            catch (EventTimeoutException e)
            {
                // this happens with Asterisk 1.0.x as it doesn't send a QueueStatusCompleteEvent
                re = e.PartialResult;
            }

            foreach (ManagerEvent e in re.Events)
            {
                if (e is QueueParamsEvent)
                {
                    QueueParamsEvent qe = (QueueParamsEvent)e;
                    Console.WriteLine("QueueParamsEvent" + "\n\tQueue:\t\t" + qe.Queue + "\n\tServiceLevel:\t" + qe.ServiceLevel);
                }
                else if (e is QueueMemberEvent)
                {
                    QueueMemberEvent qme = (QueueMemberEvent)e;
                    Console.WriteLine("QueueMemberEvent" + "\n\tQueue:\t\t" + qme.Queue + "\n\tLocation:\t" + qme.Location);
                }
                else if (e is QueueEntryEvent)
                {
                    QueueEntryEvent qee = (QueueEntryEvent)e;
                    Console.WriteLine("QueueEntryEvent" + "\n\tQueue:\t\t" + qee.Queue + "\n\tChannel:\t" + qee.Channel + "\n\tPosition:\t" + qee.Position);
                }
            }
Jul 31, 2014 at 5:26 PM
I am trying to use the code above to get an agent listing, but I am getting and error when I execute the action in either mode.. The error says
Invalid/unknown command: Agents. Use Action: ListCommands to show available commands.
Any idea why it might not recognize that command?
Aug 2, 2014 at 9:20 AM
Do you have app_queue installed? Check from the console that it exists.