Page 1 of 1

email export calls report

PostPosted: Sat Nov 23, 2013 1:13 pm
by cbsys
Hi we are running vicidial 2.7rc1 on centos 5 64-bit

we are trying to run AST_email_web_report.pl via the linux shell to email the export_calls_report as a csv attached to an email

However, we get the email, but its just a html screenshot of the export_calls_report page in vicidial admin rather than the csv file that report generates
We need the csv file its supposed to generate - I am using the following URL in the AST_email_web_report.pl , am I missing something??

$location = "http://127.0.0.1/vicidial/call_report_export.php?query_date=$begindate&end_date=$shipdate&list_id[]=--ALL--&status[]=--ALL--&campaign[]=--ALL--&run_export=1&ivr_export=NO&export_fields=STANDARD&header_row=YES&rec_fields=NONE&custom_fields=NO&call_notes=NO&SUBMIT=SUBMIT";

Re: email export calls report

PostPosted: Sat Nov 23, 2013 3:44 pm
by williamconley
First you say you are trying to run "AST_email_web_report.pl", but then you say the Location is "call_report_export.php" and you wonder why you get the html output from "call_report_export.php".

I think it is likely you are getting the output from "call_report_export.php" because that is the script you are running. Note that "AST_email_web_report.pl" is a perl script, not a web page. It cannot be "pulled" with wget or curl. It is meant to be run from the command line with "perl" (or bash, which will notice that it is a perl script and invoke perl to execute it ...).

To run it automatically (timed), you would place a line in crontab -e (similar to the many other lines already there ...), but test first directly on the command line to "perfect it" and then add the exact entry that you got to work in crontab -e.

To get it's options (at the command line in linux):
Code: Select all
perl /usr/share/astguiclient/AST_email_web_report.pl --help

To actually run it, the same line without the --help but WITH the other options listed.

Re: email export calls report

PostPosted: Mon Nov 25, 2013 5:25 am
by cbsys
I think you misunderstand
I am running AST_email_web_report.pl from the command line with the various date switches and email address as listed in the help

the perl script works fine and emails me various reports

within the script I can uncomment or comment out certain reports as I see fit for the ones I want to send
i.e. the lines starting with $location=

I have everthing commented out and $location= is set to the following:
$location = "http://127.0.0.1/vicidial/call_report_export.php?query_date=$begindate&end_date=$shipdate&list_id[]=--ALL--&status[]=--ALL--&campaign[]=--ALL--&run_export=1&ivr_export=NO&export_fields=STANDARD&header_row=YES&rec_fields=NONE&custom_fields=NO&call_notes=NO&SUBMIT=SUBMIT";

When I run the perl script I receive an email correctly
However instead of the results of the export calls report as a csv file (as you would get when you did it via the admin screen), I just get a screen shot of the export calls report screen as it would be shown before I pressed submit

I actually want AST_email_web_report.pl to send me the csv file of all calls made within a time frame, which I specify at the command line, e.g. --date=yesterday

Re: email export calls report

PostPosted: Mon Nov 25, 2013 6:04 am
by DomeDan
Never used AST_email_web_report.pl but its seams like its not meant to send csv files
# This script is designed to wget a web report and then email it as an attachment
# this script should be run from a vicidial web server.


I wrote a one-liner to email csv files automatically: http://www.vicidial.org/VICIDIALforum/v ... =2&t=29155

Re: email export calls report

PostPosted: Mon Nov 25, 2013 11:25 am
by williamconley
In that case, as it is a script designed to pull a web page ... when YOU execute that url ... do you get the original page or the CSV result file?

don't assume, or "have a look", copy and paste the exact line (replacing those replaceable parameters) or better yet echo that statement with all those replaced already and copy/paste the result. I prefer testing things one baby step at a time until they work if I'm SURE they should already be working. Usually turns out to be something simple. 8-)

Re: email export calls report

PostPosted: Mon Nov 25, 2013 12:17 pm
by cbsys
I have already done this, as I previously said, the csv file is NOT sent - I get the original html web page sent as an attachment instead

in other words, I get exactly the html page I would see if I went to the vicidial gui, admin, export calls report

I actually want the csv file

Re: email export calls report

PostPosted: Sat Nov 30, 2013 9:37 pm
by williamconley
The $location variable should be set to the URL from when you receive the CSV, if you want the CSV to be sent. If there is a "download" link on the page, right click on it and copy its URL.