Page 1 of 1

Custom Code

PostPosted: Fri Feb 02, 2018 1:58 pm
by jatomusic
Where should I post solutions and code snippets I use for our instances?

We have sometimes spikes in call volume. So to handle the drops from customers hanging up. We are setting up some list that represent time buckets. So let's say, morning shift, mid-day shift, evening shift. All the calls that drop will schedule in to a list.

I am making it an extension of the API.

DB Query
dump all calls from a range of ingroups that are status drops, only one instance of each phone number to a list 1001
Code: Select all
INSERT INTO vicidial_list (entry_date,modify_date, status, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, date_of_birth, called_count, last_local_call_time, rank, entry_list_id, comments)
SELECT call_date as entry_date, '0000-00-00 00:00:00' as modify_date,'NEW' as status,
'1002' as list_id, vl.gmt_offset_now as gmt_offset_now, 'N' as called_since_last_reset,
'1' as phone_code, vcl.phone_number as phone_number, '0000-00-00' as date_of_birth,
'0' as called_count, CONCAT(CURDATE(),' ','00:00:00') as last_local_call_time, '0' as rank, '1002' as entry_list_id, CONCAT('CALLED: ',COUNT(vcl.phone_number),' Times') as comments
FROM vicidial_closer_log vcl
LEFT JOIN vicidial_list vl ON vcl.lead_id = vl.lead_id
LEFT JOIN vicidial_list vlcheck ON vcl.phone_number = vlcheck.phone_number AND vlcheck.list_id = '1002'
WHERE vcl.call_date
BETWEEN CONCAT(CURDATE(),' ','09:00:00') AND CONCAT(CURDATE(),' ','11:59:59')
AND vcl.status = 'DROP'
AND campaign_id LIKE '90%'
AND campaign_id != '9008'
AND vlcheck.phone_number is NULL
GROUP BY vcl.phone_number
ORDER BY entry_date ASC

Re: Custom Code

PostPosted: Fri Feb 02, 2018 6:52 pm
by mflorell
We usually recommend posting snippits of code like this in the Issue Tracker(liked above)

This does look pretty similar to Drop Lists though, have you looked at that feature?

Re: Custom Code

PostPosted: Mon Feb 05, 2018 9:09 am
by jatomusic
You know I thought there was something like that and I just couldn't find it. I'll check the manual and post back.

Re: Custom Code

PostPosted: Mon Feb 05, 2018 9:29 am
by jatomusic
I have to laugh, I found another post describing all the features. I'm pretty sure it covers what I needed. I was making my code to work with the API. I have a basic working function. I'll submit it to the issue tracker. Might be useful if anyone wants the functionality via api.

T0 anyone searching, go to Admin>System Settings> Enable Drop Lists = 1

Re: Custom Code

PostPosted: Mon Feb 05, 2018 9:36 am
by mflorell
Thanks for the followup post :)