Consultation for CDR

2

Good, I'm doing a query to show all the missed calls that arrive to me in Asterisk in the last hour, but I find myself with the following problem:

If I receive 2 calls, one of them not answered and the other answered, my query shows me the unanswered, I would like it to only show me those that have not really been answered, in that interval of time.

SELECT  
    calldate as FECHA_LLAMADAS,  
    clid as CLIENTE,
    disposition as ESTADO 
FROM 
    cdr 
WHERE
    calldate >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND 
    disposition="NO ANSWER"
    
asked by Jatz o.o 08.02.2016 в 13:16
source

2 answers

1

Ok, if I understand your question correctly, then you can do the following:

SELECT  calldate as FECHA_LLAMADAS,  
        clid as CLIENTE,
        disposition as ESTADO 
FROM cdr as c
WHERE NOT EXISTS(SELECT clid 
                 FROM cdr
                 WHERE calldate >= DATE_SUB(NOW(), INTERVAL 1 HOUR) 
                 AND disposition <> 'NO ANSWER');
    
answered by 08.02.2016 в 13:37
0

What you need to rescue calls ABANDON, for Asterisk the calls ABANDON are those that were not attended by any human or machine.

Asterisk inserts all the call information of a "Queue" queue (CallCenter) in the file / var / log / asterisk / queue_log, so you should look for information there where you will find the phone number, time of abandonment , date and time, etc. Obviously you will not be able to make a MySQL query for it. You will have to dump that file to a table in the database and to do that you can use tools provided by Asterisk or third parties that is explained in the following link: link

    
answered by 12.04.2017 в 17:27