You could do that with a bit of custom work and add a “system call” to /bin/nc conditionally, you will have to do that for both incoming and outgoing calls, so no it is not easy and will possibly break things on an update.
I would however suggest that you look into AMI , it is better designed to do what you wish and runs asynchronously to your asterisk/FreePBX instance without touching it’s function.