Script to capture ANI for a specific DID and save them on a file

Version 1
    This document was generated from CDN thread

    Created by: Adrian Crisan on 12-04-2013 09:13:13 AM
    I was wondering if someone has some information and can share with me on the following:
    I am loolking in creating a script on which I can configure a specific DID (a parameter in the script) and have the script populating a file (i.e. XML) with all the calling numbers (ANI) to that specific DID. I am new to scripting, and was looking if someone can share an example script or point me into the right direction for this.
    Kind regards,