I want to integrate FreePBX with AD and do the configuration that if PC screen is locked calls must forward to external number.
Is there any solution for that?
Not for that specific scenario. You’d have to push the AD status to the AST-DB and write code to route the call to your destination from there. I wrote a BT monitor that kind of did something like that about a million years ago.