If I am correct, Elastix PBX has Asterisk running as a backend, which means it can be done with Asterisk Manager API:
Home Assistant could serve as a client and be able to subscribe and listen for events coming from Asterisk. Not sure if Elastix PBX would overwrite /etc/asterisk/manager.conf, though: