Ticket #2862 (closed Bugs: fixed)

Opened 7 months ago

Last modified 7 months ago

Error caused by an empty space in asterisk's main dir

Reported by: CristianDeluxe Assigned to: p_lindheimer
Priority: crash Milestone: 2.5
Component: Core Version: 2.4-branch
Keywords: space dir Cc:
Confirmation: Need testing SVN Revision (if applicable):
Backend Engine: Asterisk 1.4.x Backend Engine Version:

Description

Hi, first sorry for my bad English.

I'm working with FreePBX and everything work ok until some days.

When i try to update the module "Recordings" it show me this error: "I can not access the directory /var/lib/asterisk /sounds/custom/. Please make sure that it exists, and is writable by the web server."

When i try to see logs (in Tools->Asterisk Logfiles) only show "/var/log/asterisk /full - last 2000 lines Redisplay Asterisk Full debug log (last 2000 lines)"

if you see complete dir more slow, you can see an empty space between "asterisk" and "/subdir" i think that here's the problem.

Music on hold don't show any files, i think that this is caused too by empty space in dir.

I check the file "amportal.conf" and all files that contains string "/var/lib/asterisk" and any have an empty space at the end.

I open too the "install.php" file in recordings module and change this:

$recordings_astsnd_path = trim(isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk');
$recordings_astsnd_path .= trim("/sounds/");

(i add trim() to this lines) but don't fix it.

I don't know what do now...

Thanks

Change History

06/24/08 07:45:13 changed by p_lindheimer

  • component changed from - choose - to Core.

I'm sorry but I don't really understand what the issue is that you are trying to state. Can you provide some specific settings in asterisk.conf that will reproduce your error?

06/24/08 12:50:24 changed by CristianDeluxe

My "asterisk.conf" file:

[directories]
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astdatadir => /var/lib/asterisk

[options]
transmit_silence_during_record = yes
verbose = 0
debug = 0
;alwaysfork = yes ; same as -F at startup
;nofork = yes ; same as -f at startup
;quiet = yes ; same as -q at startup
;timestamp = yes ; same as -T at startup
;execincludes = yes ; support #exec in config files
;console = yes ; Run as console (same as -c at startup)
;highpriority = yes ; Run realtime priority (same as -p at startup)
;initcrypto = yes ; Initialize crypto keys (same as -i at startup)
;nocolor = yes ; Disable console colors
;dontwarn = yes ; Disable some warnings
;dumpcore = yes ; Dump core on crash (same as -g at startup)
;languageprefix = yes ; Use the new sound prefix path syntax
;internal_timing = yes
maxcalls => 0
maxload => 0.0
;runuser => asterisk
;rungroup => asterisk 
systemname => Company

and "amportal.conf"

# This file contains settings for components of the Asterisk Management Portal
# Spaces are not allowed!
# Run /usr/src/AMP/apply_conf.sh after making changes to this file

# AMPDBHOST: the host to connect to the database named 'asterisk'
AMPDBHOST=localhost

# AMPDBUSER: the user to connect to the database named 'asterisk'
AMPDBUSER=user

# AMPDBENGINE: the type of database to use
AMPDBENGINE=mysql

# AMPDBPASS: the password for AMPDBUSER
AMPDBPASS=pass

# AMPENGINE: the telephony backend engine to use
AMPENGINE=asterisk

# AMPMGRUSER: the user to access the Asterisk manager interface
AMPMGRUSER=user

# AMPMGRPASS: the password for AMPMGRUSER
AMPMGRPASS=pass

# AMPBIN: where command line scripts live
AMPBIN=/var/lib/asterisk/bin

#AMPSBIN: where (root) command line scripts live
AMPSBIN=/usr/sbin

# AMPWEBROOT: the path to Apache's webroot (leave off trailing slash)
AMPWEBROOT=/var/www/html

# AMPCGIBIN: the path to Apache's cgi-bin dir (leave off trailing slash)
AMPCGIBIN=/var/www/cgi-bin 

# AMPWEBADDRESS: the IP address or host name used to access the AMP web admin
#AMPWEBADDRESS=192.168.1.101
AMPWEBADDRESS=

# FOPWEBROOT:web root for the Flash Operator Panel
FOPWEBROOT=/var/www/html/panel

# FOPPASSWORD: the secret code for performing transfers and hangups in the Flash Operator Panel
FOPPASSWORD=pass

# FOPSORT: FOP should sort extensions by Last Name [lastname] or by Extension [extension]
FOPSORT=extension

# AUTHTYPE: authentication type to use for web admin
# If type set to 'database', the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above
# valid: none, database
AUTHTYPE=database

# AMPADMINLOGO: Defines the logo that is to be displayed at the TOP RIGHT of the admin screen.
#	        This enables you to customize the look of the administration screen.
# NOTE: images need to be saved in the ..../admin/images directory of your AMP install
# This image should be 55px in height
AMPADMINLOGO=logo.png

# USECATEGORIES: Controls if the menu items in the admin interface are sorted by category (true),
#                or sorted alphebetically with no categories shown (false). Defaults to true.
#USECATEGORIES=false

# AMPEXTENSIONS: the type of view for extensions admin 
# If set to 'deviceanduser' Devices and Users will be administered seperately, and Users will be able to "login" to devices.
# If set to 'extensions' Devices and Users will me administered in a single screen.
AMPEXTENSIONS=extensions

# POST_RELOAD: automatically execute a script after applying changes in the AMP admin
# Set POST_RELOAD to the script you wish to execute after applying changes
# If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page
# POST_RELOAD=
# POST_RELOAD_DEBUG=false

# ENABLECW: Enable call waiting by default when an extension is created
# Set to 'yes' it automatically creates the 'CW' key to enable call waiting, not
# requiring the user to dial *70 when their phone is first commissioned
ENABLECW=no

# The following are used to optionally have the freepbx backup program optionally
# send the generated backup to an ftp server
#
# FTPBACKUP=YES to enable
# FTPUSER, FTPPASSWORD, FTPSERVER must be set
# FTPSUBDIR is an optional subdirectory at the ftp server, it will cause ftp to do a cd
#
# There is no error checking so you should check to make sure these are set correctly. The
# ftp is saved after the backup, so it will not cause the local backup file to be effected
#
# FTPBACKUP=yes
#FTPUSER=asterisk
#FTPPASSWORD=password
#FTPSUBDIR=mybackupfolder
#FTPSERVER=myftpserver

# AMPMODULEXML lets you change the module repository that you use. By default, it
# should be set to http://mirror.freepbx.org/ - Presently, there are no third
# party module repositories. 
AMPMODULEXML=http://mirror.freepbx.org/

# AMPMODULESVN is the prefix that is appended to <location> tags in the XML file.
# This should be set to http://mirror.freepbx.org/modules/
AMPMODULESVN=http://mirror.freepbx.org/modules/

# AMPMODULEMSG is URL used to search for warnings or messages in the online repository
# and should not be changed.
# AMPMODULEMSG=http://mirror.freepbx.org/

AMPDBNAME=asterisk

ASTETCDIR=/etc/asterisk
ASTMODDIR=/usr/lib/asterisk/modules
ASTVARLIBDIR=/var/lib/asterisk
ASTAGIDIR=/var/lib/asterisk/agi-bin
ASTSPOOLDIR=/var/spool/asterisk
ASTRUNDIR=/var/run/asterisk
ASTLOGDIR=/var/log/asterisk

NOTE: i've changed some personal information like passwords, users and company name.

and a screenshot of the error: http://img71.imageshack.us/my.php?image=error2vy1.png

06/25/08 20:15:42 changed by p_lindheimer

  • status changed from new to closed.
  • confirmation changed from Unreviewed to Need testing.
  • resolution set to fixed.
  • milestone changed from Cut Line to 3.0.

Can you try applying this patch to: /var/www/html/admin/functions.inc.php: r5827 (trunk) r5828 (2.4) and give feedback to confirm it works. (I'm closing the bug but want to make sure there is not something else going on or I'll reopen)

Index: functions.inc.php
===================================================================
--- functions.inc.php   (revision 5815)
+++ functions.inc.php   (working copy)
@@ -140,7 +140,7 @@
        $file = file($filename);
        foreach ($file as $line) {
                if (preg_match("/^\s*([a-zA-Z0-9]+)\s* => \s*(.*)\s*([;#].*)?/",$line,$matches)) { 
-                       $conf[ $matches[1] ] = rtrim($matches[2],'/');
+                       $conf[ $matches[1] ] = rtrim($matches[2],"/ \t");
                }
        }
 

06/26/08 01:51:01 changed by CristianDeluxe

Thank you p_lindheimer, now all seems to work again.

06/27/08 01:16:41 changed by CristianDeluxe

Unfortunately the error has happened again, when I’ve updated the freepbx to last version, it shows me the same error, the logs don’t work, moh don’t show any files. I’ve modified again the “functions.inc.php” file:

in function "parse_amportal_conf"

if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_<>\"\']+)\s*$/",$line,$matches)) {
				$conf[ $matches[1] ] = rtrim($matches[2]); 
			}

and in function parse_asterisk_conf

if (preg_match("/^\s*([a-zA-Z0-9]+)\s* => \s*(.*)\s*([;#].*)?/",$line,$matches)) { 
			$conf[ $matches[1] ] = rtrim($matches[2]); 
		}

Now all working OK again: Updates, logs, moh, etc... Thanks for help!