Activating FastAGI
With very busy servers, it can help to offload the AGI scripts to another server or process. The load is reduced because there is no need to spawn a process every time a new AGI script is run.
install node
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - sudo yum install -y nodejs npm install -g npm
install pm2
sudo npm i -g pm2
Copy the whole node folder
https://git.freepbx.org/projects/FREEPBX/repos/core/browse/node
to /var/lib/asterisk/agi-bin directory
run pm2 at start up
pm2 startup pm2 install pm2-logrotate start fast agi script with pm2 pm2 start /var/lib/asterisk/agi-bin/node/fastagi-server.js (--watch) dont use watch it reloads for all files in the path pm2 save pm2 list pm2 update
centos 6
cd ~ wget http://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz # (Must check the latest version change the version name accordingly) sudo tar --strip-components 1 -xzvf node-v10.15.1-linux-x64.tar.gz -C /usr/local # (Must check the latest version change the version name accordingly)
Verify by using: node --version
npm i -g pm2
On the MiRTA PBX side, you can edit the extensions.ael and uncomment the row at top, in globals section (but this change will be overwritten at every upgrade) or add a file in /etc/asterisk/extensions.d named for example fastagi.ael and containing:
globals { FASTAGI=agi://127.0.0.1/; };
You need to reload AEL only the first time