Check if there is available lines before dial

Is possible implement a check if there isavailable lines before dial the whole number?
The top should be when a user pick up a phone to make a call and immediately a busy tone, warn a user “lines unavailable”

I read about the app “ChanIsAvail()” but i need to catch “pick up event” (sorry if i repeat…on outgoing call).
Is this possible?
If not, maybe typing digit *xx and in the same way a busy tone warn a user.

How can implement this?
Thanks for any advice

Asterisk 11.10.0