FYI, I am not sure commercial FReePBX modules (EPM) work on Raspberry Pi’s, the are not supported commercially for sure. Device and user mode is hotdesking. As far as making a phone react in a certain way, I imagine that would be more on the endpoint side.
What phones do you use? If Sangoma, EPM is free of charge. There is also the open source equivalent OSS.