There is Freeswitch 1.8.5 built from sources worked on x64 Linux.

I need to check / get internal users / trunck gateways state BEFORE using it to perform different actions in response of got conditions:
1. the called number is not exists in the directory at all;
2. the called number exist in the directory, but not registered at the time, for example don' t launch softphone;
3. the called number is inuse;
4. the called number is busy;
5. the called number is not answered due timeout
6. the called number is answered.

Is there functionality looks like device and / or extension (user) state at Freeswitch ?
And if I could still get at least 1 and 2 states and 5 of a user, I can' t get inuse, busy states.

How is the best way to get these different states for internal users, for each one and /or for trunk gateways, per each also ?