How can I get "Event: Join" information?

Oct 22, 2014 at 3:13 PM
Hi everyone! I've got a problem trying to get the next string (which I see in AMI):

Event: Join
...
Queue: %some_name%
...

How can I get it? I tried to get it from the attributes' list, but there are no such line.
What I do:
manager = new ManagerConnection(address, port, user, password);
            manager.NewState += new NewStateEventHandler(manager_Events);
            try
            {
                manager.Login();
            }
void manager_Events(object sender, ManagerEvent e)
        {
            info = (NewStateEvent)e;

            //Finished call
            if (info.ChannelState == "0")
                MessageBox.Show(info.CallerIdName + " finished a call with " + e.Attributes["connectedlinename"]);
            //Answered call
            if (info.ChannelState == "6")
                MessageBox.Show("Диспетчер "+ info.CallerIdName + " handled a call " + e.Attributes["connectedlinename"]);
            if (info.ChannelState=="4")
                MessageBox.Show("Calling from" + info.CallerIdNum);
          //  else
            //    MessageBox.Show(info.ChannelStateDesc);
        }
For example, someone is calling, I see in the AMI console nextone:
Event: Join
Privilege: call,all
Timestamp: 1413805321.269189
Channel: SIP/kt-000007c8
CallerIDNum: 12345667899
CallerIDName: unknown
ConnectedLineNum: unknown
ConnectedLineName: unknown
Queue: alma
Position: 1
Count: 1
Uniqueid: 1413805313.1992
I can get connectedlinename and connectedlinenum using e.Attributes, but i can't get queue.
Maybe, I must use some another eventHandler to get this information, or call some methods to get it?
Thanks a lot!
Oct 22, 2014 at 4:46 PM
Hi, Sorry I am a little confused by your question. Are you saying the property "Queue" is not populated in the "JoinEvent" Class?

The best way to capture specifically Join events is to use the Event "Join" on the ManagerConnection class. This will be raised when a caller enters a queue.

In your example above, i see the Queue is populated, are you saying that same event in AsterNET is not populated with the Queue name?

Also, can you tell me what version of AsterNET you're using?
Oct 23, 2014 at 9:36 AM
Thaks for your answer skrusty. No, maybe, I expressed incorrectly. I need to see in what queue new incoming call is going. In the example above, I use NewStateEventHandler to check for a new calls. But in this case, I can't see in what queue line this call is coming. For example:
I've got 3 queue lines: queue1,queue2,queue3; and 3 computers, which are connected to the queue1, queue2 and queue3. When someone is calling, Asterisk distributes this call in queue1 (for example) and NewStateEventHandler returns that someone is calling. But both 3 computers can see that call, even if they are connected to queue2 or queue3. I hope, you understand me.
How can I see in which queue this call is coming?

I use the latest version (1.0.0)
Oct 23, 2014 at 1:37 PM
Right, you're looking at the wrong event.

Queue Join tells you when a channel joints a queue, however if you want to see which queue is calling an agent (or queue member) then you need to look for the following events:

AgentCalled
// An AgentCalledEvent is triggered when an agent is rung.<br/>
/// To enable AgentCalledEvents you have to set <code>eventwhencalled = yes</code> in <code>queues.conf</code>.<br/>
/// This event is implemented in <code>apps/app_queue.c</code>
AgentConnected
/// An AgentConnectEvent is triggered when a caller is connected to an agent.
AgentComplete
/// An AgentCompleteEvent is triggered when at the end of a call if the caller was connected to an agent.
I hope this clears it up for you.
Oct 27, 2014 at 8:42 AM
No, I don't need to see which queue an agent is calling, I want to see which queue is someone who calling to agent. So, not my agents are calling, but someone calling them. Is there any event for this?
Oct 27, 2014 at 11:59 AM
Edited Oct 27, 2014 at 11:59 AM
Yes, the ones i stated above.

"An AgentCalledEvent is triggered when an agent is rung" That is exactly what you asked for. This is triggered when an agent is RUNG by a caller within a queue. I.e. when the queue tries to connect a caller with an agent.
Oct 27, 2014 at 2:49 PM
Then I don't understand how trigger it :( What I code:
            manager = new ManagerConnection(address, port, user, password);
            manager.NewState += new NewStateEventHandler(manager_Events);
            manager.AgentCalled += new AgentCalledEventHandler(manager_AgentCalled);
            try
            {
                manager.Login();
            }
void manager_Events(object sender, ManagerEvent e)
        {
            info = (NewStateEvent)e;

            //Finished call
            if (info.ChannelState == "0")
                MessageBox.Show(info.CallerIdName + " finished a call with " + e.Attributes["connectedlinename"]);
            //Answered call
            if (info.ChannelState == "6")
                MessageBox.Show("Диспетчер "+ info.CallerIdName + " handled a call " + e.Attributes["connectedlinename"]);
            if (info.ChannelState=="4")
                MessageBox.Show("Calling from" + info.CallerIdNum);
          //  else
            //    MessageBox.Show(info.ChannelStateDesc);
        }
void manager_AgentCalled(object sender, ManagerEvent e)
       {
           AgentCalledEvent a = (AgentCalledEvent)e;
           MessageBox(a.Queue);
       }
But it doesn't work when the call is comming, event "manager_AgentCalled" even not fire :(
Oct 27, 2014 at 3:06 PM
Then you've not enabled it in your queue/agent setup or you've not allowed those events to be passed to your user in the manager.conf. Once enabled, those events will be triggered!

The information below might help.
queues.conf:
eventwhencalled - when this option is set to yes, the following manager events will be generated: AgentCalled, AgentDump, AgentConnect and AgentComplete.
For assistance there i suggest you either email the asterisk-users mailing list or join #asterisk on irc.freenode.org
Oct 27, 2014 at 3:15 PM
Ok, I'll ask our Asterisk's specialist about configuration and let you know if it'll help. Thank you :)
Oct 28, 2014 at 4:36 PM
Ok, I found the answer for me. I checked the AMI console and haden't found any "Agent" events generating. But everithing enabled and allowed in configuration and user rights. So I added new handler:
manager.QueueMemberStatus+=new QueueMemberStatusEventHandler(manager_QueueMemberStatus);
Where I can get the queue string:
 public static void manager_QueueMemberStatus(object sender, ManagerEvent e)
       {
           QueueMemberStatusEvent wq = (QueueMemberStatusEvent)e;
           queue = wq.Queue;
       }
Thread is closed. Thank you.
Marked as answer by dolgovec23 on 10/28/2014 at 8:36 AM