Identifying peers in use realtime queues setup

I am working on a setup with queues using realtime configuration. I can dial between extensions, sip-peers, extensions, queues,voicemail are setup in MySQL database.
I want to add in some few features, how can i set up a feature where i can identify an peers already in a call and not attempt to send calls to it.