Activating FastAGI: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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. To configure the FastAGI please follow this or any other guide on the Internet: https://fire-tamarillo-3f6.notion.site/nodejs-fastagi-server-266693b14a1748fb93a596265691fc38 On the MiRTA PBX side, you can edit the extensions.ael and uncomment the row at top, in globals section...") |
No edit summary |
||
Line 1: | Line 1: | ||
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. | 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 == | |||
<pre> | |||
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - | |||
sudo yum install -y nodejs | |||
npm install -g npm | |||
</pre> | |||
== install pm2 == | |||
<pre> | |||
sudo npm i -g pm2 | |||
copy fastagi node script to /var/lib/asterisk/agi-bin directory | |||
</pre> | |||
Copy the whole node folder | |||
https://git.freepbx.org/projects/FREEPBX/repos/core/browse/node | |||
== run pm2 at start up == | |||
<pre> | |||
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 | |||
</pre> | |||
== centos 6 == | |||
<pre> | |||
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) | |||
</pre> | |||
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: | 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: |
Revision as of 11:29, 20 February 2023
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 fastagi node script to /var/lib/asterisk/agi-bin directory
Copy the whole node folder https://git.freepbx.org/projects/FREEPBX/repos/core/browse/node
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