There is a script that does exactly that but only for dispo's that have the sale flag turned on.
perl AST_VDsales_export.pl --help
allowed run time options:
[--date=YYYY-MM-DD] = date override
[--hour-offset=X] = print datetime strings with this hour offset
[--filename=XXX] = Name to be used for file, variables: YYYY=year, MM=month, DD=day, HH=hour, II=minute, SS=second
[--campaign=XXX] = Campaign that sales will be pulled from
[--without-camp=XXX] = Campaign that will be excluded from ALL
[--sale-statuses=XXX-XXY] = Statuses that are deemed to be "Sales". Default SALE
NOTE: To include all statuses in the export, use "--sale-statuses=---ALL---"
[--output-format=XXX] = Format of file. Default "pipe-standard"
[--with-inbound=XXX-XXY] = include the following inbound groups
[--without-in=XXX-XXY] = inbound groups that will be excluded from ALL
[--calltime=XXX] = filter results to only include those calls during this call time
[--outbound-calltime-ignore] = for outbound calls ignores call time
[--totals-only] = print totals of time and calls only
[--ftp-transfer] = Send results file by FTP to another server
[--ftp-audio-transfer] = Send associated audio files to FTP server, dated directories
[--ftp-norun] = Stop program when you get to the FTP transfer
[--ftp-server=XXXXXXXX] = FTP server to send file to
[--ftp-login=XXXXXXXX] = FTP user
[--ftp-pass=XXXXXXXX] = FTP pass
[--ftp-dir=XXXXXXXX] = remote FTP server directory to post files to
[--with-transfer-audio] = Different method for finding audio, also grabs transfer audio filenames
[--with-did-lookup] = Looks up the DID pattern and name the call came in on if possible
[--email-list=test.com:test2.com] = send email results to these addresses
[--email-sender=vicidial] = sender for the email results
[--quiet] = quiet
[--test] = test
[--debug] = debugging messages
[--debugX] = Super debugging messages
format options:
pipe-standard|csv-standard|tab-standard|pipe-triplep|pipe-vici|html-rec|fixed-as400|tab-QMcustomUSA|tab-SCcustomUSA
Example:
perl /usr/share/astguiclient/AST_VDsales_export.pl --campaign=CSSALE-DCAPTURE-DFOLLOW --sale-statuses=SALE-DMSALE-AWSALE --with-inbound=DCSAFE-DCAPTUREIN-DFOLLOWIN --ftp-transfer --ftp-audio-transfer --ftp-server=xxx.xxx.xxx.xxx --ftp-login=xxxxxx --ftp-pass=xxxxxxxx --ftp-dir=/mnt/folder/vicidial_backups/project1/sales --debugX