How to add FROM_DID value in queue_log?

I have the following asking:
I have activated the mysql queue_log option in asterisk and the queue log works fine. What I need is to add the FROM_DID value for every call into the log (or table in my case). Or additionally a way to “catch” this variable from other log table and insert it in queue_log or other table into the database. Currently I’m using MySQL triggers to catch the data logged into the queue_log table and insert it or update it into another table. But there is no the “FROM_DID” value in this log, and I need it. I need to log on which number is called from outside, because I have more than 300 DIDs and need to have statistics for all of them, as well as who is the agent answered the call. Is there any method to do that and if somebody has crashed his head in this challenge it would be nice to share it. Thanks in advance!

FROM_DID is not managed by Asterisk, so it will not automatically appear anywhere in a log that is managed by the Asterisk core.

You could use the dialplan application for writing a custom queue log entry. I presume htat works on database backends as well as the file one, although I’ve only used it with files.

DID is a much misused term in Asterisk, and I think this variable either comes from some GUI, that is misusing it, or is part of your locally written dial plan. The Asterisk code has no concept of DIDs.

Hi david55 and thank you for your answer! I have not received an e-mail and didn’t see the answer on time, sorry about that.
FROM_DID is managed by the from-trunk context, but is it possible to make it a global variable for other contexts too (ext-queues for example), or to assign it to a different variable, which I could call on other context? I am not sure if I am asking on the right way, for which I am sorry… but trying to get involved with asterisk more specifically :smile:
Is it possible to give me some directions about the custom queue_log entry, because I have searched all the internet and google for something similar, but with no success. I am trying to connect an asterisk based PBX with a custom CRM application, and this tricky part is confusing me. I need this data to be logged in realtime in the DB, so the CRM could do its job properly. Thanks in advance.

CLI> core show application QueueLog

Page 422 of Asterisk: The Future of Telephony

Wow that was quick :smile: Thanks! I will try to find what I am looking for, and if I am unable to handle will get back here. Thanks once again.

Hi again david55,
Unfortunately I was unable to understand how to set up this field into the queue log with the QueueLog() application. Could you please give me some directions? I see the _FROM_DID value in the ‘from-trunk’ context when a call comes into the system. How could get this value and use it in the queuelog() application to set it into the queue_log file (or table in my case). Thanks in advance.

Make event anything other than an existing queue log event and make additionalinfo be ${FROM_DID}. Typically call this just before calling Queue.

Hi and thanks for the answer.
Is that mean that I must make an event different fro “CONNECT, COMPLETEAGENT … and etc.” events which are standard for the queue_log, and then how to make this additionalinfo to be ${FROM_DID}? Please give me more detail info, because I am not so involved with asterisk and its CLI. Thanks again.