Issue
I'm developing a web application to manages my asterisk server ( adding extension, adding contexts managing clients, etc.. ) I'm using PHP, Mysql to do that, I used the database to add clients but for an extension, I still use the file extensions.conf. let's suppose that I added many extensions to the extensions.conf file from the web app, next I should reload the dialplan, the only way I know is by typing this command into the Asterisk CLI:
dialplan reload
so if I want to reload the dialplan from the web app I should run somewhere :
shell_exec ( "asterisk -rx 'dialplan reload'" );
the problem is this command asterisk -rx
needs root privileges.
is there a way to let the apache user run this command.
Edite :
this is the content of my /etc/asterisk/asterisk.conf file
[directories](!)
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
[options]
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin
runuser = asterisk ; The user to run as. The default is root.
rungroup = asterisk ; The group to run as. The default is root
Solution
Your command NOT need root privileges.
Check /etc/asterisk/asterisk.conf for file and permissions used.
Answered By - arheops Answer Checked By - Robin (WPSolving Admin)