Agi-mqtt with FREEPBX not just Asterisk?

If you are out of your depth, then perhaps

might be simpler to debug, it uses mosquitto_pub to connect to your broker, not a long unsupported library from somewhere. It also runs well on a raspberry.