Real time outgoing calls monitoring

Hello everybody! I am modifying an app, that creates a dashboard to visualize queues calls data and cannot find a definitive answer in the docs concerning this question.

I am connecting to asterisk using telnet and then use “Action: QueueStatus”, specifying the queue to get data. I get one QueueParams and several QueueMember entries as expected. Each QueueMember has
InCall” and “LastCall” fields. Am I correct that “InCall” takes 1 as a value only when member is acepting an incoming call? And “LastCall” has the timestamp of last taken incomming call? Thus, outgoing calls made by this member are not affecting this two values, right?

If that is so, then my second question is, what is the right way to find out that a member is Busy right now because he is making an outgoing call, and to get this call duration? Thing is that for statistics purposes I can get this data from cdr table, but calls are added there only after they ended. And I need to implement some real-time monitoring to show that the member of a Queue is acepting or making an outgoing call with its current duration.

The main idea I have right now is to listen to Newstate, Dial, Hangup events and parse that data to get the real time data about queue members outgoing calls. Am I on the right track in my approach even?

We use old Asterisk version 13 and AMI version 2.9.0. Thanks in advance for the help.

Knowledge of that version will be fading fast; it is very possible that there have been significant changes to app_queue since then.

I believe that is correct.

They are not considered a queue member when they are doing this, although the queue application does monitor a state interface, which should be configured to represent the underlying real device (assuming it is local, and not the indirectly connected via a central office, or other PABX). I believe the Status field, for the Queue Member, contains that. For an accurate status, you may need to enable options on the channel driver, especially if you want to distinguish between BUSY and INUSE. This is documented for version 13.

Thanks for the information, could you please share where is this difference documented? I tried to google it but cannot find the answer.

INUSE: at least one call going to the endpoint.
BUSY: the maximum number of calls has been reached (this needs additional options to be set).

I think the intent is that they have normal English meaings:

Although, for chan_pjsip (chan_sip is obsolete), this is explicit at:

References for chan_sip include:

Thanks for the info! I would like to add more info to my initial question here instead to asking a new one. As I need this system to track not only phones in a Queue, but any arbitrary phones we use and want to see in a dashboard, I came with this plan:

  1. Connect to AMI using telnet and listen to events information.
  2. Parse events and catch DialEnd and Hangup.
  3. When I get DialEnd with DialStatus=ANSWER, I mark CallerIDNum as BUSY doing outgoig call and DestCallerIDNum as BUSY doing incomming call, and use timestamp to mark the beginning of the call.
  4. When I get Hangup event, I mark CallerIDNum as FREE

I guess this will work in most of the cases, but if I understand correctly, it won’t work with Transfers, because there won’t be new Dial events, right? So I will be able track that caller is still in the call, as during transfer there won’t be a hangup event for caller till he finishes the call, but new callee (number the initial caller was transferred to, I mean), won’t be tracked.

I thought to listen to NewState event, but it’s not allowing me to distinguish between caller and callee and to mark call as incoming/outgoing. Is there a better way to get real-time data for phones participating in incomming/outgoing calls, to show the status and calls duration? Maybe there are other problems with my approach that I don’t know about yet?