Asterisk gui phpconfig

A PHP program for updating Asterisk Config files.

The download link below is not working. This utility is not active anymore. We have to delete this page from WIKI.

Although the link below doesn't work, the files can be downloaded from http://digium-cvs.netmonks.ca/viewcvs.cgi/phpconfig/ (and doubtless other places).


Here is the non working link for a non working demo:
http://rd.it.utah.edu/phpconfig/.




In Asterisk CVS: Do what you like to the source code, but please let me know what chages you made so I can update the CVS tree. Check for my email address in the php src headers.

In the Asterisk Dir do a "cvs checkout phpconfig"

Dave Packham "p0lar69"



Howto install PHPConfig for Asterisk.

PHPConfig is a great web frontend for editing *.conf files for asterisk. You still have to get your hands dirty and know how to setup dialplans etc, but it means you don’t have to mess with the terminal etc. You can easily view and edit config files, and then reload *, all through a web browser.

Here is how to set it up, as initially it wasn’t that straightforward as the documentation is sadly lacking. There are various security risks with this kind of setu, so for a production machine it may not be a good solution. For development on a local LAN, I think this kind of setup definitely beats vi or similar! (Especially not being a linux expert!) If you are using a Windows box to admin your * boxes, take a look at http://www.winscp.org/ - gives you an ftp like interface to all the files over SSH without setting up additional accounts. You can also edit files in directly by right-click, ‘Edit’ [Thanks Richard :-)]

You will need:


-Working Asterisk Installation
-Working Webserver e.g Apache with PHP

Simple Stages:

-Obtaining phpconfig
-Configuring phpconfig files for your setup
-Configuring manager.conf for access.
-Giving apache permission to write the files
-Testing

Obtaining phpconfig

You need to obtain the phpconfig files, and get them to your * box. Phpconfig consists of 4x PHP files, a directory of images and a reload script. Either:

1. Via CVS, like you would asterisk:
cvs checkout phpconfig

2. Via the online CVS viewer at http://asterisk.espia-net.net/horde/chora/cvs.php/phpconfig?login=2 You can then use wget or similar to get the files. Or d/l and edit on another box and ftp/ssh across.

Configuring phpconfig files

Most of the variables are setup for a default * installation, which may be fine for you.

phpconfig_init.php -> the first section includes the paths to asterisk dir etc. This should be straightforward to work out and change if needed.
If you only want to edit asterisk config files, not phone files etc you can edit the following section to remove the /tftpboot/sip_phone section:

// directories that contain your confiles

$conf_directories = array("/etc/asterisk");


You can add additional dirs for other config files etc if wished e.g. flash operator panel

At around line 46, add a ./ so it reads:

$reset_cmd = "./asterisk.reload";


This means you don’t have to move the asterisk.reload file anywhere else.

cls_phpconfig.php -> again the first section has paths to various sections of *. However you also need to make some changes [Thanks Time :-)] The change may already be done if the CVS gets updated……

In the function OC_readConfFile around line 131 change :
$this->_OC_the_file[] = fgetc($file); to : $this->_OC_the_file[] = fgets($file);


In the function OC_checkAccess around line 438 change :
$accessFile[] = fgetc($file); to : $accessFile[] = fgets($file);


Also around line 29, add a ./ so it reads:

var $_OC_reset_cmd = "./asterisk.reload";


cls_phpconfig_html.php -> You shouldn’t need to change anything here, although it includes the variables for various links etc.

phpconfig.php -> You don’t really need to change anything here.

asterisk.reload -> This is the file that connects to the manager interface to reload asterisk, so after you change configs you can actually use them! Leave it in the same dir as the php files, and chmod it to 0777. I do this via WinSCP, or you can do it from the shell.

Now the files are setup for your config, make sure they are moved under you site dir e.g /var/www/phpconfig means I can access them via http://ip.of.machine/phpconfig

Configuring manager.conf


You need to enable and setup manager.conf in order for phpconfig to work properly. This allows the reload script to reload asterisk, via the web based interface.

In /etc/asterisk/manager.conf
;
; Asterisk Call Management support
;
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0

[admin]
secret = secret
;deny=0.0.0.0/0.0.0.0
;permit=209.16.236.73/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user


First thing is to make sure ‘enabled=yes’ * will require a full stop and restart if you enable this.
You need to add the user ‘admin’ with password ‘secret’ You can alter the permit and deny lines to suit your environment and happiness with security risks.

Giving apache permission to write the files

You need to allow apache permission to write to the files in your config dir.
At the shell type:

chmod -R a+w /etc/asterisk


Which grants apache the right to write :p [Thanks Guido :-)]

Testing


You should now be able to surf to the phpconfig.php file, and read and update your files on the fly :-D
Be aware of the security risks, but enjoy. Protecting the dir with a .htaccess file is the least you should do……

By C.T.


To get the function "find text" (the extension numbers on the right when you edit a file) to work on
Mozilla/Firefox (on Windows), you have to change the javascript function "findString" in the file cls_phpconfig_html.php
around line 456. Just replace it with the function found here.

By TimeBandit


A PHP program for updating Asterisk Config files.

The download link below is not working. This utility is not active anymore. We have to delete this page from WIKI.

Although the link below doesn't work, the files can be downloaded from http://digium-cvs.netmonks.ca/viewcvs.cgi/phpconfig/ (and doubtless other places).


Here is the non working link for a non working demo:
http://rd.it.utah.edu/phpconfig/.




In Asterisk CVS: Do what you like to the source code, but please let me know what chages you made so I can update the CVS tree. Check for my email address in the php src headers.

In the Asterisk Dir do a "cvs checkout phpconfig"

Dave Packham "p0lar69"



Howto install PHPConfig for Asterisk.

PHPConfig is a great web frontend for editing *.conf files for asterisk. You still have to get your hands dirty and know how to setup dialplans etc, but it means you don’t have to mess with the terminal etc. You can easily view and edit config files, and then reload *, all through a web browser.

Here is how to set it up, as initially it wasn’t that straightforward as the documentation is sadly lacking. There are various security risks with this kind of setu, so for a production machine it may not be a good solution. For development on a local LAN, I think this kind of setup definitely beats vi or similar! (Especially not being a linux expert!) If you are using a Windows box to admin your * boxes, take a look at http://www.winscp.org/ - gives you an ftp like interface to all the files over SSH without setting up additional accounts. You can also edit files in directly by right-click, ‘Edit’ [Thanks Richard :-)]

You will need:


-Working Asterisk Installation
-Working Webserver e.g Apache with PHP

Simple Stages:

-Obtaining phpconfig
-Configuring phpconfig files for your setup
-Configuring manager.conf for access.
-Giving apache permission to write the files
-Testing

Obtaining phpconfig

You need to obtain the phpconfig files, and get them to your * box. Phpconfig consists of 4x PHP files, a directory of images and a reload script. Either:

1. Via CVS, like you would asterisk:
cvs checkout phpconfig

2. Via the online CVS viewer at http://asterisk.espia-net.net/horde/chora/cvs.php/phpconfig?login=2 You can then use wget or similar to get the files. Or d/l and edit on another box and ftp/ssh across.

Configuring phpconfig files

Most of the variables are setup for a default * installation, which may be fine for you.

phpconfig_init.php -> the first section includes the paths to asterisk dir etc. This should be straightforward to work out and change if needed.
If you only want to edit asterisk config files, not phone files etc you can edit the following section to remove the /tftpboot/sip_phone section:

// directories that contain your confiles

$conf_directories = array("/etc/asterisk");


You can add additional dirs for other config files etc if wished e.g. flash operator panel

At around line 46, add a ./ so it reads:

$reset_cmd = "./asterisk.reload";


This means you don’t have to move the asterisk.reload file anywhere else.

cls_phpconfig.php -> again the first section has paths to various sections of *. However you also need to make some changes [Thanks Time :-)] The change may already be done if the CVS gets updated……

In the function OC_readConfFile around line 131 change :
$this->_OC_the_file[] = fgetc($file); to : $this->_OC_the_file[] = fgets($file);


In the function OC_checkAccess around line 438 change :
$accessFile[] = fgetc($file); to : $accessFile[] = fgets($file);


Also around line 29, add a ./ so it reads:

var $_OC_reset_cmd = "./asterisk.reload";


cls_phpconfig_html.php -> You shouldn’t need to change anything here, although it includes the variables for various links etc.

phpconfig.php -> You don’t really need to change anything here.

asterisk.reload -> This is the file that connects to the manager interface to reload asterisk, so after you change configs you can actually use them! Leave it in the same dir as the php files, and chmod it to 0777. I do this via WinSCP, or you can do it from the shell.

Now the files are setup for your config, make sure they are moved under you site dir e.g /var/www/phpconfig means I can access them via http://ip.of.machine/phpconfig

Configuring manager.conf


You need to enable and setup manager.conf in order for phpconfig to work properly. This allows the reload script to reload asterisk, via the web based interface.

In /etc/asterisk/manager.conf
;
; Asterisk Call Management support
;
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0

[admin]
secret = secret
;deny=0.0.0.0/0.0.0.0
;permit=209.16.236.73/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user


First thing is to make sure ‘enabled=yes’ * will require a full stop and restart if you enable this.
You need to add the user ‘admin’ with password ‘secret’ You can alter the permit and deny lines to suit your environment and happiness with security risks.

Giving apache permission to write the files

You need to allow apache permission to write to the files in your config dir.
At the shell type:

chmod -R a+w /etc/asterisk


Which grants apache the right to write :p [Thanks Guido :-)]

Testing


You should now be able to surf to the phpconfig.php file, and read and update your files on the fly :-D
Be aware of the security risks, but enjoy. Protecting the dir with a .htaccess file is the least you should do……

By C.T.


To get the function "find text" (the extension numbers on the right when you edit a file) to work on
Mozilla/Firefox (on Windows), you have to change the javascript function "findString" in the file cls_phpconfig_html.php
around line 456. Just replace it with the function found here.

By TimeBandit


Created by: jht2, Last modification: Sun 20 of May, 2012 (19:20 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+