Page 1 of 1

Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Wed Jul 25, 2018 5:42 am
by thephaseusa
I have a survey campaign, and I would like to gather up all the press 1's that don't make it to an agent, and upload these records into a list/campaign where we can manually call them back. Here is what I have so far:

the mysql query to get the press 1 s for that day is:

select * from vicidial_list where security_phrase like '%INTEREST%' and last_local_call_time like '%`date +\%Y\%m\%d`%'

and here is the cron file that will run this select statement:

30 * * * * /usr/bin/mysql -u root -pmypass asterisk <<<'select * from vicidial_list where security_phrase like "\%INTEREST\%" and last_local_call_time like "\%`date +\%Y\%m\%d`\%"' |uuencode press1.csv|mail -s 'Press1' 'myemail@gmail.com'

this job makes the select output a csv file and emails every half hour. but is there a way to send to outfile and load data local infile to put this data directly into my asterisk list_id '607'?

Thanks
John M

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Wed Jul 25, 2018 6:02 am
by blackbird2306
Take a look at "VICIDIAL_IN_new_leads_file.pl" script...

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 11:35 am
by williamconley
Just get the lead IDs instead. Then, with the lead IDs list, modify "called since last" to "N" and then modify the list ID to one that is in a special outbound campaign, and optionally set the status to one that you have designated as "missed this call!" They should already be "DROP", though, so you can just leave the status if you like. This preserves the history of the lead. If you "dump and reload", you lose all previous contact information and logs. Bad idea. Basically puts you back in excel spreadsheet mode for no discernable reason.

Note that if you are using custom fields, you'll also need to check and possibly set the entry_list_id field as well.

Probably best to also put this in either a bash or php or perl script and then put that script in the crontab to avoid a huge, convoluted, single-line crontab entry that will likely get confusing eventually. In a separate script you can put each entry on its own line with comments to keep you sane six months from now when you revisit this task. Just use crontab for timing (that's what it's for). It also allows you to execute the script at will outside crontab (helpfulf for testing among other things).

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 11:44 am
by blackbird2306
thephaseusa wrote:but is there a way to send to outfile and load data local infile to put this data directly into my asterisk list_id '607'?

Sure it is much easier to change the list id and reset with a query, than to import all leads new again, but he asked how to go the difficult way :D

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 11:49 am
by williamconley
blackbird2306 wrote:
thephaseusa wrote:but is there a way to send to outfile and load data local infile to put this data directly into my asterisk list_id '607'?

Sure it is much easier to change the list id and reset with a query, than to import all leads new again, but he asked how to go the difficult way :D


OTH: putting those leads into list 607 is accomplished either way. His wording and concept aside ... if you ask a taxi driver to take you to 27th street and ask "are you gonna take me via the bridge?" if they are NOT going to take you via the bridge, they'll just not mention the bridge when discussing the actual route.

Especially if the bridge is in the other direction (such as in this case).

KISS rule

Besides: You already covered his method. Didn't want to steal your thunder. But didn't want him to be left in the dark on the easier way to do it (and with no data loss, at that).

Although I did forget to mention the "no agent URL", which would remove the need for the crontab trigger (as it happens after every call to make decisions specific to that call).

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 4:21 pm
by thephaseusa
Yes, I’ve come to the conclusion also, no need to export them, just do update vicidial_list set list_id to the one i want to outbound call this press 1 and status to new or like bill said N for called since last, Matt suggested the same thing to just change the list its in instead of exporting then importing.

Right?

no agent URL?

What i need is all the press 1’s that didnt make it to a live agent.

Can I accomplish this with no agent URL?

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 5:00 pm
by williamconley
thephaseusa wrote:What i need is all the press 1’s that didnt make it to a live agent.

Can I accomplish this with no agent URL?


"didn't make it to a live agent" ... "no agent URL". I think you answered your own question there, but if you want it spelled out: That's precisely what No Agent URL is designed for.

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 5:08 pm
by thephaseusa
Thanks Bill, and what would I put in the no agent Call URL field?

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 5:25 pm
by blackbird2306
Another take a look at:
dispo_move_list.php in agc directory!

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Thu Jul 26, 2018 7:46 pm
by thephaseusa
Thanks will do BB

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 4:55 am
by thephaseusa
In the campaign setting No Agent Call URL i now have:

VARhttp://137.27.15.180/agc/dispo_move_ ... rigger=101

Whenever a drop or timeot occurs in this press 1 campaign the list_id is changed to 607, which is the list i auto dial from on a closer campaign.
I think these are the statuses (DROP, TIMEOT) where 1 has been pressed (security_phrase changed to 1-INTERESTED) but they weren't transferred to a live agent.

Anything else WC, BB, MF?

Thank you guys for the umpteenth assist.
John M

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 5:26 am
by blackbird2306
The last part of your url is only necessary, if you want to trigger the move action only for leads from a certain list.
Please check if this is intended: "list_id=--A--list_id--B--&list_id_trigger=101"
list_id_trigger - (101,...) if set to number greater than 99, will only trigger for list_id equal to the set number(NOTE: list_id must be sent), default is disabled
list_id - (101,...) if you want to use list_id_trigger then this must be set: "list_id=--A--list_id--B--", default is disabled


Perhaps it's better to work with "exclude_status = Y " and then leaving sale status empty. So it is sure that all calls, which should go to an agent will be catched.

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 6:17 am
by thephaseusa
Yes I didn't notice that. I dont want the trigger I will remove list_id_trigger=101.

If I set exclude_status = Y and no sales status is set then what records will be moved to the new list?

what i need moved is everything that pressed 1 (security_phrase = 1-INTERESTED) which did not get transferred to a live agent.

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 6:46 am
by thephaseusa

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 8:07 am
by blackbird2306
Sorry for that, but I think we are not going the right way with No Agent URL and exclude_status = Y, because No Agent URL triggers also by No Answer and Busy. I'll look later for the right way to do this.
No Agent Call URL - This is similar to Dispo Call URL, but it is for calls
that are not sent to agents such as DROPs, No Answers, Busys and timeouts. This
option is available for Campaigns and In-Groups. This feature will only work for
auto-dial and inbound calls, not manual dial calls. For inbound calls, the
specific in-group that a call was sent to needs to have the No Agent Call URL
field filled in or this function will not run for that call.

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 10:00 am
by thephaseusa
No Agent Call URL VARhttp://137.27.15.180/agc/dispo_move_ ... st_id--B--


if the status is drop or timeot it moves the lead to list 621
is the language in the varhttp incorrect?

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 11:30 am
by blackbird2306
Ok I found the right solution now!! And the best of this story is you are now able to use "dispo_move_list.php" in conjunction with your "security_phrase" field without thinking of real DROP statuses and so on.

1. Dispo move list file wasn't intended to look into "security_phrase", but we can tweak this a little bit. The dispo (status) field, which could be DROP, TIMEOUT or another real system status is now the "security_phrase" field. This field will be populated by the customer by pressing 1, 2 and so on and we are able to catch this in NO AGENT URL directly after pressing by --A--security_phrase--B-- variable. That means we change "dispo=--A--dispo--B--" to "dispo=--A--security_phrase--B--".

2. The only thing you need to change is the "sale_status" part. In my example it is "1-DEMOCRAT" for default setting after installation. But you need to change it according to your "Survey Response Digit Map" settings. It is important that you take exactly the right string like "1-INTERESTED" and not only "1-INTER" (as you mentioned in your LIKE query). It is also possible to define more triggers like "sale_status=1-INTERESTED---2-SUPERINTERESTED" ...

Try this as no agent url (only change the sale_status):
VARhttp://137.27.15.180/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--security_phrase--B--&user=NOAGENTURL&pass=--A--call_id--B--&new_list_id=607&&sale_status=1-DEMOCRAT&reset_dialed=Y&log_to_file=1

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Jul 27, 2018 11:53 am
by thephaseusa
Okay I made the change. Brilliant!

The ones who press 1 will stay go to a live agent, but the ones who press 1 and somehow don't make it to a live agent will have move_list run on it, and the lead will move to the new list?

Thanks, I didn't mean to take up your time solving this. I owe you one BB! (i owe you a few actually)
JAM
leaveyourbody.com

Update!!! I just saw the first new lead in the move list!! DROP AGent Not Available
It works!

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Mon Jul 30, 2018 11:54 am
by blackbird2306
You are welcome. Yes only the ones with pressed "1" and somehow don't go to an agent will be moved. But something very important to know:
If the "security_phrase" is not empty then this field will not be overwritten. This means for examples you are calling a lead the first time and the called party doesn't response and you have e.g set the "Survey No-Response Action" to DROP. Then the "security_phrase" field will be populated with "X-NO RESPONSE". But at your second call the the customer will press "1-INTERESTED". Then this field will stay with "X-NO RESPONSE" and won't be changed to "1-INTERESTED". To solve this problem you can delete the security_phrase manually by a sql query or you can change this behavior in the code. Then security_phrase will always be overwritten:
You need to comment out with "#" the green line in "agi-VDAD_ALL_outbound.agi" (about line 1307):

# record what they entered
$sec_phrase_SQL='';
# if (length($security_phrase)<1)
{$sec_phrase_SQL = "security_phrase='$opt_description',";}

PS: By the way there was a "&" too much in the url at "new_list_id=607&&sale_status=1-DEMOCRAT". It has no negative effect but to be formally correct:
VARhttp://137.27.15.180/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--security_phrase--B--&user=NOAGENTURL&pass=--A--call_id--B--&new_list_id=607&sale_status=1-DEMOCRAT&reset_dialed=Y&log_to_file=1

Re: Cron Job to Gather Press 1's and Upload/Add to List

PostPosted: Fri Aug 10, 2018 7:24 am
by thephaseusa
Wow you think of everything Blackbird. I didn't get that far in my thinking, but you are of course correct. This works on the first call but not on subsequent calls if something is entered in the security_phrase field, and every call where the recording is played there will be entered either 1-Interested 9-Not interested or X-no response. So I will make the change you advised in agi-VDAD_ALL_outbound.agi.

I noticed the 2 instances of ampersand and wondered about that, thanks for clarifying that was a harmless typo.

I hope you are still monitoring BB. I have changed my Survey Method from Agent Xfer to VMAIL_NO_INST. So now the press 1's seem to be dispositioned as SVYVM. Can I now just change sale_status=SVYVM ? I changed sale_status=1-INTERESTED to sale_status=1-INTERESTED---SVYVM& just to catch both. And it appears all press 1's are sent to vm without instruction, a recording is made, lead is moved to the closer list and closer campaign. This could be useful if I didn't want to take the time to listen to all voicemails, and instead just call them as they come in.

John Merritt
leaveyourbody.com