AMI's AgentConnect event rarely being fired

Hi. I’m developing a .NET application that utilizes AsterNet to register to AMI’s events like NewChannel event, AgentConnect event and HangUp event. Our company’s asterisk guy has set up a dev asterisk server (version 13) , a call queue, and two extensions associated with that queue. When i debug the application, and call the queue, i get the NewChannel event always fired, but when i pick up one of the two extension’s phones i dont always get the AgentConnect event fired, actually most of the times i don’t. The HangUp even is also always fired. can someone elaborate on when AgentConnect event supposed to be fired, or suggest any misconfigurations i must have applied to my environment ? my AsterNet version is version 1.0.0. Thanks in advance.

AgentConnect
Raised when a queue member answers and is bridged to a caller in the queue.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerEvent_AgentConnect

well, but the event isn’t fired when I debug it this way, im calling my queue and picking an agent extension, and only sometimes the event is being fired. i noticed that if i wait several seconds and then pick up the phone then the event is more likely to be fired. maybe the bug is on AsterNet side, ill try to debug it using a simple Telnet client.

1 Like

I just made a test on my development server, and the event is fired immediately the call is answered by an agent in the queue.

0 : Event: AgentConnect
1 : Privilege: agent,all
2 : Channel: PJSIP/6001-00000005
3 : ChannelState: 6
4 : ChannelStateDesc: Up
5 : CallerIDNum: 6001
6 : CallerIDName:
7 : ConnectedLineNum: 102
8 : ConnectedLineName: Ambiorix
9 : AccountCode:
10 : Context: internal
11 : Exten: 200
12 : Priority: 2
13 : Uniqueid: 1457156880.55
14 : DestChannel: SIP/102-0000001b
15 : DestChannelState: 6
16 : DestChannelStateDesc: Up
17 : DestCallerIDNum: 102
18 : DestCallerIDName: Ambiorix
19 : DestConnectedLineNum: 6001
20 : DestConnectedLineName:
21 : DestAccountCode:
22 : DestContext: internal
23 : DestExten: 200
24 : DestPriority: 1
25 : DestUniqueid: 1457156880.56
26 : Interface: SIP/102
27 : Queue: support
28 : HoldTime: 8
29 : MemberName: SIP/102
30 : RingTime: 7

did you use AsterNet as the client to AMI ? what Asterisk version do you use ?

thanks

Asterisk Call Manager/2.5.0

I made my own code base on PHP.

ok thanks for your time, but i dont think we can help each other and isolate the source of my problem if we are using both a different dev platform and asterisk server. i have just posted this issue also on AsterNet’s github issues page.
thanks a lot.

1 Like

I also encountered a similar issue. I am using Asterisk 20.4.0. I have made some changes to app_queue.c. To ensure that the AgentConnect event is always sent when a member answers, we should move the event publication earlier in the code flow, right after confirming that we have a valid peer connection but before any announcements or additional processing that might fail.

Please don’t post modified Asterisk code on the forum. It cannot be used as part of the main Asterisk project as it lacks the “paper” trail giving Sangoma a licence to use it in their commercial products, and the Sangoma people will not look at it to avoid its influencing their solution to the problem.

All code contributions need to be made through github. I’m not sure of the how the licence grant is currently handled, as I haven’t submitted code since before the move to github, I’m also not sure if difference files are allowed there, but if they are, they need to be plain text, not screen images (which is also the case for log files and configuration files, on this forum).

I apologize for posting modified Asterisk code on the forum. I understand that it cannot be used as part of the main Asterisk project due to the lack of a “paper trail” giving Sangoma a license to use it in their commercial products.

I will remove the images immediately and ensure that all future code contributions will be made through GitHub in accordance with the project’s guidelines.

Thank you for bringing this to my attention.

Since the devs haven’t seen it in the forum just repost it into github by logging into github and entering an issue, and they will be able to use it.

To actually get changes included you create a pull request and sign the CLA electronically. If there is no intention of seeing something included in the project then it can be distributed however the person wishes, and even putting up a pull request does not guarantee inclusion.