Lync call accounting for user or departmental billing


Lync Call Accounting and Departmental Billing now has its own page –

Wondering if there is a great demand out there for free solution to Lync call accounting? I have been playing around with SQL queries to see what I can do, and if there is a demand will spend some more time putting together something to share with the Lync community.

One of the difficulties in accounting for Lync calls is when a 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 as Referred-By, and also included in the Lync monitoring server reports.

All 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.

Its pretty crude, but here’s what I am getting straight out of SQL so far:

Example output can be downloaded here.

Leave a comment and let me know what you think.



  1. Hey Guy, cheers for your feedback! I have actually seen that one, however the monitoring database doesn't seem to record the same information. It appears that the referred by information in the monitoring database captures all calls that were forwarded, whereas in the SIP headers it could be one of 3. I will be posting the SQL query and PowerShell used to generate the report on my blog soon as I've given it a tidy up and commented all the code.

  2. You're off to a great start Andrew – you seem to have captured everything that moves! I agree of course that you definitely need to be capturing (and 'billing') the party that initiates the transfer!

    And just to be difficult, what if A calls B, B transfers to C (so far so good) – and then *C* transfers to D? Is everyone's involvement in the call being captured? (Yes, this degree of detail is often more about forensics than cost recovery).

  3. Thanks for everyone's feedback, the free Lync Call Accounting solution now has its own home!

    Version 1.0 just released with major improvements over the last release.

    – 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


Please enter your comment!
Please enter your name here