One of the difficulties in accounting for Lync calls is when the call is forwarded. Lync passes the A-Party caller ID through to the C-Party, and lists the B-Party who forwarded the call as the "referrer". This is included in the SIP header Referred-By field, and also included in the Lync monitoring server reports. All of the SIP providers I have dealt with here in New Zealand don't seem to cater for this situation. Instead I get call records that show A-Party called C-Party, with no indication of who actually initiated the call to the C-Party, and therefore should be charged to that leg of the call.
There is now a script and application version of the solution:
Lync Call Reports (App)
- Search and filter results
- CSV export
- Ability to bill based on users Active Directory department or company field
- Import vendor rate cards to perform call rate and cost calculations
- Determines if the destination and callers number is in the same calling region to apply a local call rate
- Import vendor gateways - Determines call direction - inbound, outbound, forwarded, Lync-to-Lync
- Handles billing of forwarded calls using the Referred-By information
- Download the application here
- Ensure that you have the required pre-requisites noted below
- Add PSTN gateways from your topology to Gateways.csv in the program directory
- Add call rates to RateCard.csv in the program directory (see more about this below)
- Run LyncCallReports.exe (as admin if required)
- Enter environment and report settings
- Select "Run" to run the report
- After the report has run you can view and filter results on the "Results" tab, or from the produced CSV file
The script should be run with the follow pre-requisites:
- Lync 2010 or Lync 2013 environment
- PowerShell 2.0+
- User account which is a member of CSAdministrator
- SQL permissions to read, create and drop databases in temdb (sysadmin to drop and create, db_datareader and db_datawriter to run query. The next version will require less permissions)
- SQL permissions to read LcsCDR database (db_datareader)
- SQL Server Management Studio installed or Shared Management Objects.msi from the SQL Server feature pack
- Make sure that SQL allows remote connections - theres a good article about this here

Lync Call Accounting (Script)
This script queries the Lync CDR database (LcsCDR), performing calculations on the data to provide you useful call billing information.- Ability to bill based on users Active Directory department or company field
- Import vendor rate cards to perform call rate and cost calculations
- Import vendor gateways- Determines call direction - inbound, outbound, forwarded, Lync-to-Lync
- Handles billing of forwarded calls using the Referred-By information
How does it work?
- Firstly using another script of mine Get-LyncEnabledObjects, the script collects all Lync enabled objects. Those objects are then searched for in Active Directory, and the Company and Department fields added to the results. This data is then stored as a table called LyncCallAccountingUsers on your SQL Monitoring server in the tempdb.
- The vendor rate card is imported from CSV to a table called LyncCallAccountingRateCard in the tempdb.
The CSV should be named RateCard.csv and include all calling regions globally. The SQL query matches the caller and called numbers to the best matching destination number pattern to determine the calling region. See more about this below.
- The vendor gateways are imported from CSV to a table called LyncCallAccountingGateways in the tempdb.
The CSV should be named Gateways.csv and include Vendor, GatewayIP and Location. The SQL query matches the gateway used in the call, to the GatewayIP addresses in the CSV. This will be further utilised in a later release to support multiple vendor rate cards.
- At this point we have all the important information stored in SQL temporary tables, and we will use this in the next step to perform the calculations required to get the information we want.
- The LyncCallAccounting.sql query is now executed. This can take quite some time to complete depending on the date range specified and the amount of call data in the monitoring server. In my demo environment I am processing about 80 call records per second, so a date range that involves 10,000 call records will take about 2 minutes to complete. If you have huge amounts of monthly data to process, I suggest you modify the script to process daily and append to a CSV file.
- Once the query completes it will save the output to a CSV file.

An example output can be found here
Instructions
- Download the script from here
- Unzip the file and extract to the location of your choice
- Open LyncCallAccounting.ps1, read the release notes, and update the parameters to match your environment
- Check prerequisites below
- Run the script as a user with CSAdministrator and SQL db_owner or sysadmin rights in accordance with the following usage examples.
Parameters
- -StartDate <Start Date> : Report start date and time e.g. 2014-01-01 00:00:00.00
- -EndDate <End Date> : Report start date e.g. 2014-02-01 00:00:00.00
- -CSVExportPath <File Path to save CSV> : Path to save the output file e.g. C:\CDRs.csv
- -RateLocalCallingArea <Rate for local calls e.g. 0.05> (optional) : Rate for call when destination and callers number are in the same calling region.
- -DbGateways <DROP|UseExisting> (optional) - If the LyncCallAccountingGateways table already exists this option allows you to drop and recreate or to use the existing table. In either case if the table doesn't exist it will be created. This is an optional parameter, if you don't specify anything the default is to drop any existing tables if they exist.
- -DbUsers <DROP|UseExisting> (optional) - If the LyncCallAccountingUsers table already exists this option allows you to drop and recreate or to use the existing table. In either case if the table doesn't exist it will be created. This is an optional parameter, if you don't specify anything the default is to drop any existing tables if they exist.
- -DbRateCard <DROP|UseExisting> (optional) - If the LyncCallAccountingRateCard table already exists this option allows you to drop and recreate or to use the existing table. In either case if the table doesn't exist it will be created. This is an optional parameter, if you don't specify anything the default is to drop any existing tables if they exist.
- -RateCardCSV <File Path to RateCard CSV file> (optional) : Path to rate card CSV file. Defaults to script path.
- -GatewaysCSV <File Path to Gateways CSV file> (optional) : Path to gateways CSV file. Defaults to script path.
- -ADPath <AD search scope for Lync objects e.g. DC=domain,DC=co,DC=nz> : AD distinguished name of search scope to include for Lync objects
- -SQLDataSource_LyncMonitoring <Monitoring SQL server e.g. MonitoringDbServer\Instance> : Monitoring server SQL backend database.
- -LyncPool <Lync Pool FQDN> (optional) : Lync pool, only required for PowerShell remoting.
- -SQLScriptPath <Path to LyncCallAccounting.sql> (optional): Used to specifiy alternative path to SQL query file
- -DebugMode <$true|$false> (optional): Enables a verbose output
Example
Prerequisites
The script should be run from a server with the follow pre-requisites:
- Lync 2010 or Lync 2013 environment
- PowerShell 2.0+
- User account which is a member of CSAdministrator
- SQL permissions to read, create and drop databases in temdb (sysadmin to drop and create, db_datareader and db_datawriter to run query)
- SQL permissions to read LcsCDR database (db_datareader)
- SQL Server Management Studio installed or Shared Management Objects.msi from the SQL Server feature pack
- Make sure that SQL allows remote connections - theres a good article about this here
- If not run from a server with Lync management tools installed, you must specify the Lync Front End pool
Notes
- Tested on Lync 2013 with SQL 2008 R2 and SQL 2012 monitoring databases
- Tested with a user account with Domain Admin and SQL sysadmin rights
The Rate Card
Call rates are calculated from the RateCard.csv file by using the destination number pattern, and its associated rate. The rate card included with the program has over 40,000 rows to capture all call destinations globally, however it doesn't need to be this complicated if all you require is basic costings. To help make sense of how it all works, here's a scenario used by a customer based here in New Zealand (NZ):NZ International Dialling Code 64
NZ National Landline 649, 647, 646, 644, 643
NZ Mobile 642
NZ Freephone 64800, 64508
NZ Premium 64900
We can capture call costs very easily by adding the following to RateCard.csv:
| Destination | Rate | Country | CallingArea |
| 649 | 0.05 | NZ | Upper North Island |
| 647 | 0.05 | NZ | Waikato and Bay of Plenty |
| 646 | 0.05 | NZ | Middle North Island |
| 644 | 0.05 | NZ | Lower North Island |
| 643 | 0.05 | NZ | South Island |
| 642 | 0.05 | NZ | Mobile |
| 64800 | 0.13 | NZ | NZ Freecall |
| 64508 | 0.00 | NZ | NZ Freecall |
| 64900 | 0.00 | NZ | NZ Premium |
| 64 | 0.1 | NZ | Any other NZ destination |
| 1 | 0.30 | World | World |
| 2 | 0.30 | World | World |
| 3 | 0.30 | World | World |
| 4 | 0.30 | World | World |
| 6 | 0.30 | World | World |
| 7 | 0.30 | World | World |
| 8 | 0.30 | World | World |
| 9 | 0.30 | World | World |
Additional to the rates applied from the rate card, there is an additional process that compares the destination number to the callers number, and if found to be in the same calling region, the local calling area rate is applied to the call. This is useful if local calls are free or at a lesser rate than other national calls.


Has this been tested on Lync 2010?
ReplyDeleteHey Jeff,
ReplyDeleteMost of my testing has been on Lync 2013, however I have worked with someone recently to improve compatibility on Lync 2010. The main deference is that Lync 2010 doesn't come with as many built in SQL views, so I add to work around this in the SQL query. If you have any issues let me know so I can help out. I also have a bunch of improvements I will be releasing in the coming weeks.
Hi, just trying to test your script but getting error "ERROR: Invoke-SQLCmd2 - Could not connect to database". I have given myself sysadmin to tempdb, am part of the CSADMIN groups and read access to LcsCDR. I'm assuming it uses the logged in user credentials to connect to the DB?
ReplyDeleteAny sugestions. Thanks
Hey Stewart, Yes it will run as the logged on user. Something I missed in the pre-req's and a possible cause of the issue is the requirement for the SQL Server Management Studio or Shared Management Objects.msi from the SQL Server feature pack. If you are using the GUI version I have just updated to include a debug mode. Download the new exe's and run in debug mode, then use the contact page to send me the results. I will try my best to figure this out for you.
ReplyDeleteHi Andrew
ReplyDeleteI've been trying to get the Lync Call Accounting Script to work but the script keeps failing with the below error:
Add-SqlTable : Cannot create Table that does not contain at least one Column.
At C:\rawsoft\Tools\LyncCallAccounting\LyncCallAccounting.ps1:161 char:21
+ Add-SQLTable <<<< -ServerInstance $SQLDataSource_LyncMonitoring -Database $SQLDatabase_t
empdb -TableName "LyncCallAccountingUsers" -DataTable $LyncEnabledObjects -ColumnCollation "Latin1_
General_CI_AI"
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-SqlTable
Write-DataTable : System.Management.Automation.MethodInvocationException: Exception calling "WriteT
oServer" with "1" argument(s): "Cannot access destination table 'LyncCallAccountingUsers'." ---> Sy
stem.InvalidOperationException: Cannot access destination table 'LyncCallAccountingUsers'. ---> Sys
tem.Data.SqlClient.SqlException: Invalid object name 'LyncCallAccountingUsers'.
The account I am using is a member of CsAdministrators and is a SysAdmin on the Arc Mon SQL instance in the environment.
Regards
Hey Dewalt, I haven't seen that error before but I will do my best to assist you resolve it. Have you tried the GUI version? It has better error checking and a debug mode. Could you try that and post back the errors you get?
ReplyDeleteThanks Andrew, for some reason the GUI version does not run from any of the Server 2008 R2 servers I've tried to launch it from. It keeps failing when I try and open it just showing an unexpected error occurred.
DeleteI am able to run it from my Windows 7 and 8.1 desktop, I will be at the client site today and test the GUI version from my desktop and let you know if I get any errors.
Hi
DeleteI am getting a different response now, seems like the LyncCallAccountingUsers table in the TempDb database cannot be created. The LyncCallAccountingGateways table does get created so I don't think this is caused lack of permissions.
Add-SqlTable : Cannot create Table that does not contain at least one Column.
At C:\rawsoft\Tools\LyncCallAccounting\LyncCallAccounting.ps1:161 char:21
+ Add-SQLTable <<<< -ServerInstance $SQLDataSource_LyncMonitoring -Database $SQLDatabase_tempdb -TableName "Ly
ncCallAccountingUsers" -DataTable $LyncEnabledObjects -ColumnCollation "Latin1_General_CI_AI"
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-SqlTable
Write-DataTable : System.Management.Automation.MethodInvocationException: Exception calling "WriteToServer" with "1" ar
gument(s): "Cannot access destination table 'LyncCallAccountingUsers'." ---> System.InvalidOperationException: Cannot a
ccess destination table 'LyncCallAccountingUsers'. ---> System.Data.SqlClient.SqlException: Invalid object name 'LyncCa
llAccountingUsers'.
Have you got SQL Management Studio or "Shared Management Objects.msi" from the SQL Server feature pack installed where you are running the app? Also please confirm Lync 2010/2013?
ReplyDeleteThe users table gets created after querying Lync for all objects which are enabled for Lync. It looks as though this process has failed resulting in an attempt to create a database with no columns. Are there any other errors before this? Were you able to run the GUI version? It is much more verbose in its error output, something I haven't quite got to adding to the script version. I am currently working on project that requires the script version so will be updating in the next few weeks.
Thanks Andrew, I have run the script from a server with SSMS installed and still get errors for the users table not being created. I don't get any error prior to this.
DeleteUnfortunately I was not able to use the GUI version at the client site, but I tested the script in my lab and it worked fine. I suspect that the account I am using does not have all the required SQL permissions.
I'll try and get the script version updated for you today. Hopefully then we can see exactly what's going on.
DeleteDownload the file again here - http://gallery.technet.microsoft.com/Lync-Call-Accounting-dd28ca5d. I have included v2.1 with better error checking and debug mode. Hope this helps you find the problem :)
DeleteThanks for this, below is results, I have asked the clients SQL team to se if they can assist me as well.
DeleteSTEP: Check databases
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> DEBUG: Exception calling "Fill" with "1" argument(s): "Invalid object name 'tempdb.dbo.LyncCallAccountingUsers'."
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> DEBUG: Exception calling "Fill" with "1" argument(s): "Invalid object name 'tempdb.dbo.LyncCallAccountingRateCard'.
--> Creating SQL table LyncCallAccountingUsers...
--> ERROR: There was an error while running the Add-SQLtable command
--> DEBUG: Exception calling "Create" with "0" argument(s): "Create failed for Table 'dbo.LyncCallAccountingUsers'. "
--> Writing DataTable to SQL table LyncCallAccountingUsers...
--> ERROR: There was an error writing to the database while running Write-DataTable
--> DEBUG: Exception calling "WriteToServer" with "1" argument(s): "Cannot access destination table 'LyncCallAccounting
Users'."
"
No worries. Are they the only errors you are seeing? I cant help but think the "Exception calling "Create" with "0" argument(s)" is happening because the Get-LyncEnabledObjects is failing. Do the other 2 databases get created successfully?
DeleteYes the other tables gets created, I had the SQL guys run a trace when I run the script and they say they can't see that the users table even attempts to create. I am busy trying to break down the script so I can run the get-LyncEnabledObjects portion on its own and see if there are any failures here.
DeleteI have de-constructed the bits that appear not to be working. I have removed some of the try/catch statements so you get more errors in the console. If you don't get something that helps, try removing the same from the SQL functions at the top. Download from here - https://onedrive.live.com/redir?resid=FF04F2F514D1EFC!56850&authkey=!AD4ZPbpc2ldjYdo&ithint=file%2cps1. Hope this helps you get to the bottom of it!!
DeleteThis comment has been removed by the author.
ReplyDeleteGreat job!
ReplyDeletebig thanks!
Thank you for this great application, i am running the script but the report is not showing any data , i have added a gateway and still i am not getting anything in the report , please find below the output of running the script
ReplyDeleteThanks in Advance
PS C:\Users\Administrator.Contoso\Desktop\LyncCallAccounting\LyncCallAccounting_v2.0and2.1> C:\Users\Administrator.Contoso\Desktop\LyncCallAccounting\LyncCallAccounting_v2.0and2.1\LyncCallAccounting.ps1
Lync Commandlets already loaded...
AD Commandlets already loaded...
SQL table LyncCallAccountingGateways already exisits, dropping and recreating...
Importing vendor gateways card to SQL table...
SQL table LyncCallAccountingUsers already exisits, dropping and recreating...
Getting Lync enabled objects and writing to SQL table...
WARNING: Region "Redmond" does not exist.
WARNING: Access number "sip:caa@contoso.com" contains some invalid properties. Use Set- cmdlet to fix the invalid properties.
SQL table LyncCallAccountingRateCard already exisits, dropping and recreating...
Importing vendor rate card to SQL table...
Running CDR SQL query, this may take some time to complete depending on record volume...
Processing of SQL query results completed, creating output file (C:\03-12-2014-07.03.18-LyncCDRs.csv)...
Elapsed Time: 39.2889199 seconds
Please remember to provide feedback at http://www.lync.geek.nz/p/call-accounting.html
the script is running without any error., but i am still getting an Empty reports.
ReplyDeleteAny one faced this issue before.
Appreciate your feedback.
Thanks
Hey Sherif, can you post the output so I can take a look?
ReplyDeleteHello Andrew i have fixed the issue , it was in my Monitoring reports :) i really like your application its awesome thank you very much for this great app :) can you please advise how can i get the GUI version ?
ReplyDeleteThanks
Nice one, glad you got it working :) You can get the GUI version here - http://gallery.technet.microsoft.com/Lync-Call-Reports-fad8a3b6. Requirements are pretty much the same as the script version.
ReplyDeleteI'm sure I'm doing something stupid, I just cant figure it out.....
ReplyDeleteI have tried different Monitoring Database settings... FQDN\reportserver, FQDN\LcsCDR, FQDN\Default, FQDN\CDRDB
----- Started at 2015-01-16 21:11:50 -----
STEP: Load required PowerShell Modules
--> Lync Commandlets already loaded...
--> AD Commandlets already loaded...
STEP: Start Lync Call Reports processing
STEP: Check databases
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> SQL table LyncCallAccountingGateways does not exist, creating...
STEP: Create SQL Table LyncCallAccountingGateways...
--> Importing vendor gateways csv and creating DataTable...
--> Creating the SQL table LyncCallAccountingGateways...
--> ERROR: There was an error creating the SQL table LyncCallAccoutingGateways while running the Add-SQLTable command
--> Writing DataTable to the SQL table LyncCallAccountingGateways...
--> ERROR: Could not connect to database while running the Write-DataTable command
--> ERROR: There was an error writing to the database while running Write-DataTable
--> SQL table LyncCallAccountingUsers does not exist, creating...
STEP: Create SQL Table LyncCallAccountingUsers
--> Finding all Lync enabled objects...
--> ERROR: There was an error creating the LyncCallAccountingUsers DataTable
--> Creating SQL table LyncCallAccountingUsers...
--> ERROR: There was an error creating the SQL Table LyncCallAccountingUsers
--> Writing DataTable to SQL table LyncCallAccountingUsers...
--> ERROR: There was an error writing DataTable to the SQL table LyncCallAccountingUsers
--> SQL table LyncCallAccountingRateCard does not exist, creating...
STEP: Create SQL table LyncCallAccountingRateCard
--> Importing vendor rate card csv to DataTable...
--> Creating the SQL table LyncCallAccountingRateCard...
--> ERROR: There was an error creating the SQL table LyncCallAccountingRateCard while running the Add-SQLTable command
--> Writing DataTable to the SQL table LyncCallAccountingRateCard...
--> ERROR: Could not connect to database while running the Write-DataTable command
--> ERROR: There was an error writing to the database while running Write-DataTable
STEP: Run CDR SQL query - this may take some time to complete depending on record volume...
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
STEP: Create output - Processing of SQL query results completed!
--> Switch to the results tab to search and filter your data
--> Creating output file (C:\LyncCDR121sd.csv)...
STEP: All Done!!
--> Elapsed Time: 161.6375574 seconds
--> To help improve this free tool, please remember to provide feedback at http://www.lync.geek.nz/p/call-accounting.html
Hey, It looks like there is a SQL connection or permission issue. In the latest version of the script there is a switch for debug mode, which will give a more verbose output and hopefully narrow things down. The SQL server should be in format FQDN\SQL_Db_Instance_Name, and requires remote connections are enabled in SQL. It is also a requirement that SQL Management Studio is installed on the machine where you run the script. When I have connection issues I always fire up Management Studio and login with the same account the script runs with. This will confirm connectivity and credentials are OK. Let me know how you go, and post the debug output back here if you are still stuck.
Deletegetting same error even after checking all what u said in last post..pls help me out
DeleteCan you paste the output while running in debug mode?
DeleteHi andrew...I have posted the output yesterday...Please look into that and guide me what is the issue.
ReplyDeleteI don't see the post from yesterday, please try again then ill take a look.
DeleteHi Andrew...Please find the output in debug mode as mentioned below:
ReplyDelete----- Started at 2015-03-09 15:31:16 -----
STEP: Start Lync Call Reports processing
STEP: Check databases
--> WARNING: There was an issue determining if the SQL table LyncCallAccountingGateways exists, atempting to drop and recreate...
STEP: Create SQL Table LyncCallAccountingGateways...
--> Importing vendor gateways csv and creating DataTable...
--> Creating the SQL table LyncCallAccountingGateways...
--> Writing DataTable to the SQL table LyncCallAccountingGateways...
--> WARNING: There was an issue determining if the SQL table LyncCallAccountingUsers exisits, atempting to drop and recreate...
STEP: Create SQL Table LyncCallAccountingUsers
--> Finding all Lync enabled objects...
--> Creating SQL table LyncCallAccountingUsers...
--> Writing DataTable to SQL table LyncCallAccountingUsers...
--> WARNING: There was an issue determining if the SQL table LyncCallAccountingRateCard exisits, atempting to drop and recreate...
STEP: Create SQL table LyncCallAccountingRateCard
--> Importing vendor rate card csv to DataTable...
--> Creating the SQL table LyncCallAccountingRateCard...
--> Writing DataTable to the SQL table LyncCallAccountingRateCard...
STEP: Run CDR SQL query - this may take some time to complete depending on record volume...
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> DEBUG: Exception calling "Fill" with "1" argument(s): "Invalid object name 'VoipDetails'."
STEP: Create output - Processing of SQL query results completed!
--> Switch to the results tab to search and filter your data
--> Creating output file (C:\LyncCallAccounting\LyncCDRs.csv)...
STEP: All Done!!
--> Elapsed Time: 472.0736372 seconds
--> To help improve this free tool, please remember to provide feedback at http://www.lync.geek.nz/p/call-accounting.html
Looks like permissions are OK. Are you on Lync 2010 or 2013? Are you getting any output at all in the CSV or is it empty?
DeleteHi andrew..I have posted..please look into that..
ReplyDeleteHi Andrew...I am on Lync 2013. No, I am not hetting any output in CSV. It is empty.
ReplyDeleteAre the temp databases being created in tempDb?
DeleteIf they are, then the following script can be run in SQL Management Studio directly. This will give you more SQL specific errors. Note that you may need to change the date range at the bottom of the SQL script - https://onedrive.live.com/redir?resid=FF04F2F514D1EFC!72759&authkey=!AIqAYf6SRPxJvrg&ithint=file%2csql
Hi andrew...Sorry but can you pls tell me how to chek temp databases being created in tempDb? Here, in Databases-System Databases-tempDb-Tables-dbo.LyncCallAccountingGateways..AM i looking right way or wrong? Pls guide me,,,
ReplyDeleteYep correct there should be 3 LyncCallAccountingxxx tables under tempDb. Looks like you found them.
DeleteHello Andrew...When I ran the script in Management studio, It is giving me following error:
ReplyDeleteMsg 208, Level 16, State 1, Line 5
Invalid object name 'VoipDetails'
"VoipDetails" is a table under the LcsCDR database. Can you confirm it exists? In the SQL script you may need to fully qualify VoipDetails (e.g. LcsCDR.dbo.VoipDetails) in the FROM section, although I have not seen this as an issue before. If that works then may also need to apply the same logic to the other JOIN's in that section.
ReplyDeleteNo Andrew...I did not find "VoipDetails" table under the LcsCDR database. And can you pls give me detailed steps how to do fully qualify VoipDetails in the FROM section? I have not any idea regarding the same...
ReplyDeleteYou should have this table, if you don't its not going to work. Use the contacts page to get in touch, I'd like to get a screen shot of the tables in your LcsCDR Db.
ReplyDeleteHave sent you mail by contacts page...
ReplyDeleteHi Andrew....I implemented successfully Lync Call Accounting in my IT environment. It is showing all the call reports. Now, I have one query. In LyncCDRs.csv file, I am getting all call details, but rate,Call charge, charge to company and charge to department information is shows as ---. So why it is like that?
ReplyDeleteGreat news! Rate and call charge are calculated using the gateways and ratecard csv files - have you updated these to suit your environment? company/department charge to is pulled from the AD users company/department field - is this information populated for you users?
DeleteHi Andrew.
DeleteI am getting below
-----
STEP: Check databases
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> SQL table LyncCallAccountingGateways does not exist, creating...
STEP: Create SQL Table LyncCallAccountingGateways...
--> Importing vendor gateways csv and creating DataTable...
--> Creating the SQL table LyncCallAccountingGateways...
--> ERROR: Could not connect to database while running Add-SQLtable
--> ERROR: There was an error while running the Add-SQLtable command
--> Writing DataTable to the SQL table LyncCallAccountingGateways...
--> ERROR: Could not connect to database while running the Write-DataTable command
--> ERROR: There was an error writing to the database while running Write-DataTable
--> SQL table LyncCallAccountingUsers does not exist, creating...
HI Andrew,
DeleteI am getting below
STEP: Check databases
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> ERROR: Could not connect to database while running Invoke-SQLCmd2
--> ERROR: There was an error while running the Invoke-Sqlcmd2 command
--> SQL table LyncCallAccountingGateways does not exist, creating...
STEP: Create SQL Table LyncCallAccountingGateways...
--> Importing vendor gateways csv and creating DataTable...
--> Creating the SQL table LyncCallAccountingGateways...
--> ERROR: Could not connect to database while running Add-SQLtable
--> ERROR: There was an error while running the Add-SQLtable command
--> Writing DataTable to the SQL table LyncCallAccountingGateways...
--> ERROR: Could not connect to database while running the Write-DataTable command
--> ERROR: There was an error writing to the database while running Write-DataTable
--> SQL table LyncCallAccountingUsers does not exist, creating...
Looks like you have a database connectivity issue. I suggest installing SQL Management tools on the machine you are running the script from so that you can confirm you can access the Db's. This will confirm network and credentials are OK. Let me know the result.
DeleteHi Andrew...I am looking for rate and call charge. I configured properly, but i am not finding any details regarding rate and call charge in LcsCDRs.csv file. So what can be the issue?
ReplyDeleteHave configured your gateways in gateways.csv, and updated the ratecard.csv to suit?
DeleteYes Andrew...I have done so.I have sent you both files and my output files on your mail id. Can u please go through them and help me out?
ReplyDeleteI didn't receive your email.
DeleteDoes the app report on PSTN dial-in conferences? i.e. - we want to charge back for people using the 800 number to join a lync conference.
ReplyDeleteCurrently do it doesn't do this, if I get some spare time I'll have a look at how I might be able to report on this seperately.
DeleteThanks!
DeleteIs there a way to read from the Lync database, but right to a tempdb on another server?
ReplyDeleteThis comment has been removed by the author.
DeleteTotally, you could even use a permanent database rather than temp. Out of the box there are no config options to do this, however if you are vaguely familiar with PowerShell you can tweak it yourself.
Delete$SQLDatabase_tempdb specifies the database name to save temp data, you can leave it as tempdb or change to whatever database you want. Then you need to create a new variable to the other SQL server then replace $SQLDataSource_LyncMonitoring with the new variable wherever there is a reference to $SQLDatabase_tempdb on the same line.
e.g.
Invoke-SQLCmd2 -ServerInstance $SQLDataSource_NewSQLServer -Database $SQLDatabase_tempdb -Query "DROP TABLE LyncCallAccountingRateCard"
That should sort it.
Hi Andrew,
ReplyDeleteOutput file is returning following fields empty Rate, CallCharge, ChargeToCompany, ChargeToDepartment.
Have you updated the rate card and gateways csv's? Any errors?
Delete