Affect of Freepbx on Asterisk generated events

Hi everyone,

We have a Freepbx installation on a server that has an analog card of 4 ports. We are listening to events generated by Asterisk using the Asterisk Manager with AsterNet library in our C# application. We are particularly interested in:

  1. New Call event
  2. Call picket event
  3. Hangup event

However, what we have noticed is that Call Picked event is coming to our application with a certain delay, roughly 7-9 seconds. Due to this, we mark the call pick up event time very late in our CRM.

My question is: Is there any possibility that Freepbx scripting or any other such thing be affecting the timely occurrence of such event and it may be reaching late to us in our application? Has anyone experienced any such thing?

FreePBX can not control when Asterisk sends events. There are hundreds of different combinations of events to detect a proper call answer. You haven’t even told us which one you are using.

@tm1000,

These are the events we are listening to AsterNET library:

manager = new ManagerConnection(address, port, user, password);
manager.KeepAlive = true;
this.manager.ReconnectIntervalFast = 10;
this.manager.DefaultEventTimeout = 1000;

manager.UnhandledEvent += new ManagerEventHandler(manager_Events);
manager.NewChannel += new NewChannelEventHandler(manager_NewChannel);
manager.Hangup += new HangupEventHandler(manager_Hangup);
manager.NewState += new NewStateEventHandler(manager_NewStateEvent);
manager.NewCallerId += new NewCallerIdEventHandler(manager_NewCallerId);

manager.AgentConnect += new AgentConnectEventHandler(manager_AgentConnect);
manager.AgentCalled += new AgentCalledEventHandler(manager_AgentCalled);
manager.AgentComplete += new AgentCompleteEventHandler(manager_AgentComplete);

When we log the events to file, we get the following:

11/28/2017 6:28:52 PM;manager_NewCallerId
11/28/2017 6:28:52 PM;NewCallerIdEvent {CallerIdName:<unknown>; CallerIdNum:03208111366; CidCallingPres:0 (Presentation Allowed, Not Screened); DateReceived:6:28:52 PM; Privilege:call,all; UniqueId:1511875726.66; Channel:DAHDI/2-1; Attributes:[channelstate:4; channelstatedesc:Ring; connectedlinenum:<unknown>; connectedlinename:<unknown>; language:en; context:from-analog; exten:s; priority:1; linkedid:1511875726.66]}
11/28/2017 6:28:54 PM;manager_NewCallerId
11/28/2017 6:28:54 PM;NewCallerIdEvent {CallerIdName:03208111366; CallerIdNum:03208111366; CidCallingPres:0 (Presentation Allowed, Not Screened); DateReceived:6:28:54 PM; Privilege:call,all; UniqueId:1511875726.66; Channel:DAHDI/2-1; Attributes:[channelstate:4; channelstatedesc:Ring; connectedlinenum:<unknown>; connectedlinename:<unknown>; language:en; context:from-trunk; exten:1002; priority:6; linkedid:1511875726.66]}
11/28/2017 6:29:04 PM;manager_NewStateEvent
11/28/2017 6:29:04 PM;NewStateEvent {ChannelState:5; ChannelStateDesc:Ringing; CallerIdNum:102; CallerIdName:102; Connectedlinenum:03208111366; ConnectedLineName:03208001356; DateReceived:6:29:04 PM; Privilege:call,all; UniqueId:1511875727.67; Channel:PJSIP/102-00000023; Attributes:[language:en; context:from-internal; exten:102; priority:1; linkedid:1511875726.66]}
11/28/2017 6:29:04 PM;manager_NewStateEvent
11/28/2017 6:29:04 PM;NewStateEvent {ChannelState:6; ChannelStateDesc:Up; CallerIdNum:102; CallerIdName:102; Connectedlinenum:03208111366; ConnectedLineName:03208111366; DateReceived:6:29:04 PM; Privilege:call,all; UniqueId:1511875727.67; Channel:PJSIP/102-00000023; Attributes:[language:en; context:from-internal; exten:102; priority:1; linkedid:1511875726.66]}
11/28/2017 6:29:04 PM;manager_NewStateEvent
11/28/2017 6:29:04 PM;NewStateEvent {ChannelState:6; ChannelStateDesc:Up; CallerIdNum:03208111366; CallerIdName:03208111366; Connectedlinenum:<unknown>; ConnectedLineName:<unknown>; DateReceived:6:29:04 PM; Privilege:call,all; UniqueId:1511875726.66; Channel:DAHDI/2-1; Attributes:[language:en; context:macro-dial-one; exten:s; priority:53; linkedid:1511875726.66]}
11/28/2017 6:29:17 PM;manager_Hangup
11/28/2017 6:29:17 PM;HangupEvent {Cause:16; CauseTxt:Normal Clearing; ChannelState:6; ChannelStateDesc:Up; CallerIdNum:102; CallerIdName:102; Connectedlinenum:03208111366; ConnectedLineName:03208111366; DateReceived:6:29:17 PM; Privilege:call,all; UniqueId:1511875727.67; Channel:PJSIP/102-00000023; Attributes:[language:en; context:from-internal; priority:1; linkedid:1511875726.66]}

We have a 1-to-1 mapping from each analog channel to defined PJSIP extensions and we are not sure what are we doing wrong in all this which is leading to late arrival of events to our application? is it something at server end?

It wouldn’t be Asterisk. We’ve based large parts of Zulu and FreePBX around AMI events, they never come in slow.

@tm1000,

From the log, can you help or guide what steps should I take to fix this?