DNIS number

hello

I need to detect the the DNIS number when calling to my *. And i want to set this DNIS number inside the Accountcode field inside my database. How can i do this ?