Export Call Report with carrier info
Posted: Thu Jan 15, 2015 10:03 pm
Hello.
I am trying to attach the carrier to the Export Call Report, i am wondering if someone already have done this before.
Until now my best approach is to JOIN vicidial_log and call_log and get the carrier from the channel string i can wotk with this, but there are many many Call Attempts that has length_in_sec 0 and doesnt have any record under call_log, i am matching via uniqueid.
First i get all the rows only restricted by date
But there are A LOT of missing entries on call_log
Can you point me to a better approach for this?
Also i realize that there are more records on vicidial_log then what i get if a run the Export Call Report to all the campaigns, why could be happening this difference?
For example:
But if i run the Export Call Report selecting all the campaigns it only gives me 6040 records, i would like to know why those 311 of difference.
Hope anyone can help with this, thank you in advance!
I am trying to attach the carrier to the Export Call Report, i am wondering if someone already have done this before.
Until now my best approach is to JOIN vicidial_log and call_log and get the carrier from the channel string i can wotk with this, but there are many many Call Attempts that has length_in_sec 0 and doesnt have any record under call_log, i am matching via uniqueid.
MariaDB [asterisk]> select * from vicidial_log AS a LEFT JOIN call_log as b ON a.uniqueid = b.uniqueid WHERE DATE_FORMAT(call_date,'%Y-%m-%d') BETWEEN '2014-12-01' and '2014-12-01' AND b.uniqueid IS NOT NULL LIMIT 2;
+-------------------+---------+------------+-------------+---------------------+-------------+------------+---------------+--------+------------+--------------+------+----------+-----------+------------+-------------+----------+--------------+-------------------+---------------------+--------------------+-------+---------------+-------------+---------------+----------------------+---------------------+-------------+---------------------+------------+---------------+---------------+
| uniqueid | lead_id | list_id | campaign_id | call_date | start_epoch | end_epoch | length_in_sec | status | phone_code | phone_number | user | comments | processed | user_group | term_reason | alt_dial | called_count | uniqueid | channel | channel_group | type | server_ip | extension | number_dialed | caller_code | start_time | start_epoch | end_time | end_epoch | length_in_sec | length_in_min |
+-------------------+---------+------------+-------------+---------------------+-------------+------------+---------------+--------+------------+--------------+------+----------+-----------+------------+-------------+----------+--------------+-------------------+---------------------+--------------------+-------+---------------+-------------+---------------+----------------------+---------------------+-------------+---------------------+------------+---------------+---------------+
| 1417455696.256899 | 51285 | 2014100202 | CAMPAIGN | 2014-12-01 09:41:49 | 1417455709 | 1417455758 | 49 | DEC | 1 | 619XXXXXXX | 308 | MANUAL | N | AGENTS | AGENT | MAIN | 4 | 1417455696.256899 | SIP/CARRIER2-0000d6c9 | Local Channel Line | Local | 192.168.4.147 | 7619XXXXXXX | 7619XXXXXXX | M2010941350000051285 | 2014-12-01 09:41:36 | 1417455696 | 2014-12-01 09:42:38 | 1417455758 | 62 | 1.03 |
| 1417455924.256929 | 41860 | 2014100202 | CAMPAIGN | 2014-12-01 09:45:39 | 1417455939 | 1417455967 | 28 | DEC | 1 | 619XXXXXXX | 308 | 619XXXXXXXMANUAL | N | AGENTS | AGENT | MAIN | 5 | 1417455924.256929 | SIP/CARRIER1-0000d6cf | Local Channel Line | Local | 192.168.4.147 | 7619XXXXXXX | 7619XXXXXXX | M2010945240000041860 | 2014-12-01 09:45:24 | 1417455924 | 2014-12-01 09:46:07 | 1417455967 | 43 | 0.72 |
+-------------------+---------+------------+-------------+---------------------+-------------+------------+---------------+--------+------------+--------------+------+----------+-----------+------------+-------------+----------+--------------+-------------------+---------------------+--------------------+-------+---------------+-------------+---------------+----------------------+---------------------+-------------+---------------------+------------+---------------+---------------+
First i get all the rows only restricted by date
- Code: Select all
MariaDB [asterisk]> select count(*) from vicidial_log AS a LEFT JOIN call_log AS b ON a.uniqueid = b.uniqueid WHERE DATE_FORMAT(call_date,'%Y-%m-%d') BETWEEN '2014-12-01' and '2014-12-31';
+----------+
| count(*) |
+----------+
| 244064 |
+----------+
1 row in set (0.25 sec)
But there are A LOT of missing entries on call_log
- Code: Select all
MariaDB [asterisk]> select count(*) from vicidial_log AS a LEFT JOIN call_log AS b ON a.uniqueid = b.uniqueid WHERE DATE_FORMAT(call_date,'%Y-%m-%d') BETWEEN '2014-12-01' and '2014-12-31' AND b.uniqueid IS NULL;
+----------+
| count(*) |
+----------+
| 106107 |
+----------+
1 row in set (3.59 sec)
Can you point me to a better approach for this?
Also i realize that there are more records on vicidial_log then what i get if a run the Export Call Report to all the campaigns, why could be happening this difference?
For example:
- Code: Select all
MariaDB [asterisk]> select count(*) from vicidial_log WHERE DATE_FORMAT(call_date,'%Y-%m-%d') BETWEEN '2014-12-03' and '2014-12-03';+----------+
| count(*) |
+----------+
| 6351 |
+----------+
1 row in set (0.22 sec)
But if i run the Export Call Report selecting all the campaigns it only gives me 6040 records, i would like to know why those 311 of difference.
Hope anyone can help with this, thank you in advance!