Discussion:
automated CDR reports
m***@mattkeys.net
2012-07-18 02:01:43 UTC
Permalink
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
Nathaniel Watkins
2012-07-18 02:42:49 UTC
Permalink
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-***@list.sipfoundry.org [mailto:sipx-users-***@list.sipfoundry.org] On Behalf Of ***@mattkeys.net
Sent: Tuesday, July 17, 2012 10:02 PM
To: sipx-***@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
m***@mattkeys.net
2012-07-18 02:53:43 UTC
Permalink
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-***@list.sipfoundry.org [mailto:sipx-users-***@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-***@list.sipfoundry.org<mailto:sipx-users-***@list.sipfoundry.org> [mailto:sipx-users-***@list.sipfoundry.org]<mailto:[mailto:sipx-users-***@list.sipfoundry.org]> On Behalf Of ***@mattkeys.net<mailto:***@mattkeys.net>
Sent: Tuesday, July 17, 2012 10:02 PM
To: sipx-***@list.sipfoundry.org<mailto:sipx-***@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>
m***@mattkeys.net
2012-07-18 05:11:33 UTC
Permalink
#!/bin/sh
today=$(date +%Y-%m-%d)
email="***@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-***@list.sipfoundry.org [mailto:sipx-users-***@list.sipfoundry.org] On Behalf Of ***@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-***@list.sipfoundry.org<mailto:sipx-users-***@list.sipfoundry.org> [mailto:sipx-users-***@list.sipfoundry.org]<mailto:[mailto:sipx-users-***@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-***@list.sipfoundry.org<mailto:sipx-users-***@list.sipfoundry.org> [mailto:sipx-users-***@list.sipfoundry.org]<mailto:[mailto:sipx-users-***@list.sipfoundry.org]> On Behalf Of ***@mattkeys.net<mailto:***@mattkeys.net>
Sent: Tuesday, July 17, 2012 10:02 PM
To: sipx-***@list.sipfoundry.org<mailto:sipx-***@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>
m***@mattkeys.net
2012-07-18 05:31:20 UTC
Permalink
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-***@list.sipfoundry.org [mailto:sipx-users-***@list.sipfoundry.org] On Behalf Of ***@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="***@example.com<mailto:***@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-***@list.sipfoundry.org<mailto:sipx-users-***@list.sipfoundry.org> [mailto:sipx-users-***@list.sipfoundry.org]<mailto:[mailto:sipx-users-***@list.sipfoundry.org]> On Behalf Of ***@mattkeys.net<mailto:***@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-***@list.sipfoundry.org<mailto:sipx-users-***@list.sipfoundry.org> [mailto:sipx-users-***@list.sipfoundry.org]<mailto:[mailto:sipx-users-***@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-***@list.sipfoundry.org<mailto:sipx-users-***@list.sipfoundry.org> [mailto:sipx-users-***@list.sipfoundry.org]<mailto:[mailto:sipx-users-***@list.sipfoundry.org]> On Behalf Of ***@mattkeys.net<mailto:***@mattkeys.net>
Sent: Tuesday, July 17, 2012 10:02 PM
To: sipx-***@list.sipfoundry.org<mailto:sipx-***@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>
Tony Graziano
2012-07-18 10:34:18 UTC
Permalink
The onboard reports are written in jasper. You might look at whether they
have a CLI option there and the reports can be customizable as well.
Post by m***@mattkeys.net
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. :)
****
** **
*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)****
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"****
** **
** **
** **
*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
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.****
** **
** **
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.****
** **
** **
*Sent:* Tuesday, July 17, 2012 10:02 PM
*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****
_______________________________________________
sipx-users mailing list
List Archive: http://list.sipfoundry.org/archive/sipx-users/
--
LAN/Telephony/Security and Control Systems Helpdesk:
Telephone: 434.984.8426
sip: ***@voice.myitdepartment.net

Helpdesk Customers: http://myhelp.myitdepartment.net
Blog: http://blog.myitdepartment.net
Loading...