Ticket #3643 (new Bugs)

Opened 4 years ago

Last modified 3 years ago

agi-bin/phpagi.php has hard coded paths

Reported by: tbyte Assigned to:
Priority: minor Milestone: Undetermined
Component: FreePBX Framework Version: 2.5-branch
Keywords: Cc:
Confirmation: Need Feedback Distro:
Backend Engine: Asterisk 1.6 Distro Ver:
Backend Ver: SVN Revision (if applicable):

Description

agi-bin/phpagi.php has hard coded paths for asterisk etc and spool dirs.

Attachments

phpagi.php.diff (0.8 kB) - added by tbyte on 04/29/09 20:19:40.

Change History

04/29/09 20:19:40 changed by tbyte

  • attachment phpagi.php.diff added.

05/02/09 15:09:59 changed by p_lindheimer

  • priority changed from major to minor.
  • confirmation changed from Unreviewed to Need Feedback.

The proposed patch brings up some questions and issues. You are running parse_amportal_conf() and parse_asterisk_conf() from within the phpagi.php which does not necessarily have access to those functions (and normally does not) since this is a library used for AGI scripts. It's more likely to make the AGI script fail.

Furthermore, we do not want to be parsing the amportal.conf file every time an AGI script is run.

You will fine that the following globals are defined for all channels:

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                                                                                                                             

which are parsed form the config files. If you want to propose a patch that pulls these out of the channel we can have a review. However, it may be tricky if data is needed from these prior to setting up the connections.

05/02/09 16:39:10 changed by tbyte

How will anything be fine when the paths are wrong ?

ASTETCDIR = /etc/asterisk is /usr/local/etc/asterisk ASTMODDIR = /usr/lib/asterisk/modules is /usr/local/lib/asterisk ASTVARLIBDIR = /var/lib/asterisk is /usr/local/share/asterisk ASTAGIDIR = /var/lib/asterisk/agi-bin is /usr/local/share/asterisk/agi-bin

and I don't actualy see the problem every agi script to read the conf. Every program reads some conf on execution why should agi scripts have hard coded paths ? Or should those paths be changed on install (which ofcourse can be overwriten on update) ?

08/25/09 16:38:35 changed by p_lindheimer

  • milestone changed from 2.6 to 2.7.

tbyte,

you missed my point. We pass in the paths that are configured in amportal.conf into the above channel variables which are available by the agi script.

However - I applied the requested change from another ticket to php-asmanager.php (the one in ~admin/common) which resulted in multiple other broken components that had ripple affects. It broke ARI and generate_hints.php so far as I have found. I am tempted to put it back but will probably refrain for now and see if other issues are reported.

The dilemma of course here is that you need this file included first to get the AGI channel open in order to get those variables...

So ... I would suggest you come up with a solution that does not end up having to include all of the functions.inc.php or go parsing all of amportal.conf. One suggestion would be a modification of the form:

if (! @include "my_phpagi_override_file.conf") {
  // default values as currently exist
  define(...)
}

for now moving this to 2.7 pending some further decisions.

01/28/10 13:06:07 changed by p_lindheimer

  • milestone changed from 2.7 to 2.8.