That may need to be greater than or equal to ( >= ) instead of just greater 
than, it's 1:30 and there's not much call volume at the moment. :)

From: sipx-users-boun...@list.sipfoundry.org 
[mailto:sipx-users-boun...@list.sipfoundry.org] On Behalf Of m...@mattkeys.net
Sent: Wednesday, July 18, 2012 1:12 AM
To: Discussion list for users of sipXecs software
Subject: Re: [sipx-users] automated CDR reports

#!/bin/sh
today=$(date +%Y-%m-%d)
email="b...@example.com<mailto:b...@example.com>"
subject="Abandoned calls for $today"

# insert a header line into the csv.
/bin/echo "FROM,TO,START_TIME,END_TIME" > /tmp/abandoned.csv
/usr/bin/psql -At -F ',' SIPXCDR -U postgres -c "SELECT * FROM view_cdrs WHERE 
failure_status = '487' and start_time > '$today'" | \
/bin/cut -d ',' -f 2,3,4,6 >> /tmp/abandoned.csv

# uncomment to email it as the message body
# /bin/cat /tmp/abandoned.csv | /bin/mail -s "$subject" "$email"

# uncomment to email csv as an attachment
# you need the "sharutils" yum package installed for this to work

/usr/bin/uuencode /tmp/abandoned.csv abandoned.csv | /bin/mail -s "$subject" 
"$email"



From: 
sipx-users-boun...@list.sipfoundry.org<mailto:sipx-users-boun...@list.sipfoundry.org>
 
[mailto:sipx-users-boun...@list.sipfoundry.org]<mailto:[mailto:sipx-users-boun...@list.sipfoundry.org]>
 On Behalf Of m...@mattkeys.net<mailto:m...@mattkeys.net>
Sent: Tuesday, July 17, 2012 10:54 PM
To: Discussion list for users of sipXecs software
Subject: Re: [sipx-users] automated CDR reports

Thanks for the lead Nathaniel. I found some older documentation on how to do it 
using psql here : http://wiki.sipfoundry.org/display/~rgdans/CDR+Extras . The 
example command, "psql -At -F "," SIPXCDR -U postgres -c "select * from 
view_cdrs", seems to work for what I need. I can work with this data and filter 
it out by the status field but it would probably be easier/more efficient to 
have psql do the work for me. I'm still tinkering on the syntax for the query. 
I'll post it back to the list when I figure it out.


From: 
sipx-users-boun...@list.sipfoundry.org<mailto:sipx-users-boun...@list.sipfoundry.org>
 
[mailto:sipx-users-boun...@list.sipfoundry.org]<mailto:[mailto:sipx-users-boun...@list.sipfoundry.org]>
 On Behalf Of Nathaniel Watkins
Sent: Tuesday, July 17, 2012 10:43 PM
To: Discussion list for users of sipXecs software
Subject: Re: [sipx-users] automated CDR reports

Matt - we are accessing the cdr database via an odbc connection in windows - a 
scheduled task launches an access app that exports the prior days data to a csv 
for input into our billing software - it's a bit bloated, but works well 
enough.  This will need re-worked if/when cdrs are ported to mongodb.


From: 
sipx-users-boun...@list.sipfoundry.org<mailto:sipx-users-boun...@list.sipfoundry.org>
 
[mailto:sipx-users-boun...@list.sipfoundry.org]<mailto:[mailto:sipx-users-boun...@list.sipfoundry.org]>
 On Behalf Of m...@mattkeys.net<mailto:m...@mattkeys.net>
Sent: Tuesday, July 17, 2012 10:02 PM
To: sipx-users@list.sipfoundry.org<mailto:sipx-users@list.sipfoundry.org>
Subject: [sipx-users] automated CDR reports

Is there a way to dump all CDRs via the CLI? Specifically I'm looking to write 
a script and cronjob it for 23:59 to dump all abandoned calls for the day as 
CSV and email them to someone. I consulted the wiki 
(http://wiki.sipfoundry.org/display/sipXecs/Call+Detail+Records+Web+Service) 
but it only describes per user and not all history like seen as superadmin.

Thanks,
Matt


________________________________
This message and any files transmitted with it are intended only for the 
individual(s) or entity named. If you are not the intended individual(s) or 
entity named you are hereby notified that any disclosure, copying, distribution 
or reliance upon its contents is strictly prohibited. If you have received this 
in error, please notify the sender, delete the original, and destroy all 
copies. Email transmissions cannot be guaranteed to be secure or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. Garrett County Government therefore does not 
accept any liability for any errors or omissions in the contents of this 
message, which arise as a result of email transmission.


Garrett County Government,
203 South Fourth Street, Courthouse, Oakland, Maryland 21550 
www.garrettcounty.org<http://www.garrettcounty.org>
_______________________________________________
sipx-users mailing list
sipx-users@list.sipfoundry.org
List Archive: http://list.sipfoundry.org/archive/sipx-users/

Reply via email to