PsychUK
Ok, this confuses me. May I clarify just a few things.
Guests cannot directly dial out from their rooms, they have to dial the operator (the receptionist) who dials the number and then connects the line to the room
This being the case there is switchboard software (and hardware) that can automate this process, but you want to code it yourself
Now, I am assuming that you do not have an interface between your computer and the phone line, so the time the call starts and ends must be triggered by the receptionist How does the receptionist know when the call ends And what if she is busy when the call ends and doesn't log the call as ended
Personally I would contact your phone service provider and see if they have an 'out of the box' solution, as I think what you want is a call management program and I am afraid that is beyond the scope of these forums.