Is there a way to find out why sometimes different data arrives in the AgentComplete event through AMI?

The scenario is generated through a channel originate command from the CLI:

channel originate Local/12365473333333333@marcador-eventos2_outbound-gencall extension s@marcador-eventos2_outbound"

The associated contexts are as follows:

[marcador-eventos2_outbound-gencall]
include => gencallbaseoutbound

[marcador-eventos2_outbound]
exten => s,1,Answer()
exten => s,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
exten => s,n,Queue(eventos2_outbound,ht)
exten => s,n,Hangup()

In the gencallbaseoutbound context of the dial plan:

[gencallbaseoutbound]
exten => _12365473XXNXXXXXX,1,NoOp(Llamada de Salida Marcador: ${EXTEN})
same => n,SIPAddHeader(X-Asterisk-TipoLlamada:celular) ; Envio Tipo Llamada al Gateway Core
same => n,Dial(SIP/SERVIDOR_BORDE_0/${EXTEN},$[${TIMEOUT}-5],HhrTt)
same => n,Goto(s-${DIALSTATUS},1)

In various tests of the same scenario, these are the results:

Successful scenario:

Event: AgentComplete^M
Privilege: agent,all^M
SequenceNumber: 4342^M
File: manager.c^M
Line: 1957^M
Func: manager_default_msg_cb^M
SystemName: 1^M
Channel: Local/12365473333333333@marcador-eventos2_outbound_outbound-gencall-0012dd40;1^M
ChannelState: 6^M
ChannelStateDesc: Up^M
CallerIDNum: 12365473333333333^M
CallerIDName: ^M
ConnectedLineNum: 1062^M
ConnectedLineName: ^M
Language: en^M
AccountCode: ^M
Context: marcador-eventos2_outbound-gencall^M
Exten: s^M
Priority: 7^M
Uniqueid: 1-1702483419.6340260^M
Linkedid: 1-1702483419.6340260^M
DestChannel: SIP/1062-001ac5be^M
DestChannelState: 6^M
DestChannelStateDesc: Up^M
DestCallerIDNum: 1062^M
DestCallerIDName: ^M
DestConnectedLineNum: 12365473333333333^M
DestConnectedLineName: ^M
DestLanguage: es^M
DestAccountCode: ^M
DestContext: agentes^M
DestExten: s^M
DestPriority: 1^M
DestUniqueid: 1-1702483457.6340285^M
DestLinkedid: 1-1702483419.6340260^M
Queue: eventos2_outbound^M
Interface: SIP/1062^M
MemberName: SIP/1062^M
HoldTime: 0^M
TalkTime: 6^M
Reason: agent^M

Unsuccessful scenario:

Event: AgentComplete^M
Privilege: agent,all^M
SequenceNumber: 2603^M
File: manager.c^M
Line: 1957^M
Func: manager_default_msg_cb^M
SystemName: 1^M
Queue: eventos2_outbound^M
Interface: SIP/1062^M
MemberName: SIP/1062^M
HoldTime: 0^M
TalkTime: 40^M
Reason: agent^M

I’m not sure if the description is coherent, but the behavior is strange. I have a reasonable theory that it could be due to memory or cache issues. I’m not sure how to correct or handle calls properly to ensure consistent behavior.

Examining a debug level log may show the state of things and comparing the two cases may show what is different, otherwise examining the code and how things work.

Do you have any documentation available to gain a better understanding of how AMI processes these types of events? The issue I’m encountering is that, on some occasions with the AgentComplete event, it includes the value of uniqueid , while on other occasions, it does not. I’ve enabled “manager set debug on” directly in the CLI to observe the behavior, but I’m still unsure why this discrepancy occurs. During runtime, calls are queued and processed correctly. The version of Asterisk used for testing is “Asterisk 18.16.0.” I apologize if my explanation is unclear.

AMI doesn’t process them. Parts of Asterisk produce internal events (app_queue in this case) and also optionally provide a mechanism to turn them into AMI events. This is purely in the court of app_queue.

Thank you very much. I will review what you mentioned and will provide feedback on whether I manage to understand the reason or not.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.