Operating System - Linux
1835543 Members
3070 Online
110078 Solutions
New Discussion

Re: What to change in this program to make it works?

 
SOLVED
Go to solution
debian111
Regular Advisor

What to change in this program to make it works?

Hi,
I prepered AMP (Asterisk Management Portal) and I got a web interface, and now I got a error message

Warning: file(/etc/asterisk/voicemail.conf): failed to open stream: Permission denied in /var/www/recordings/includes/login.inc on line 48

Warning: file(/etc/asterisk/sip_additional.conf): failed to open stream: No such file or directory in /var/www/recordings/includes/login.inc on line 86


I opened above folder using
/var/www# cat -n recordings/includes/login.inc


and part of source code is bellow
34
35 if (isset($_POST['username']) &&
36 isset($_POST['password'])) {
37 $username = $_POST['username'];
38 $password = $_POST['password'];
39 }
40
41 // when login, make a new session
42 if ($username && $password && !$ari_no_login) {
43
44 $auth = false;
45
46 // check voicemail login
47 if (!$auth) {
48 $lines = file($asterisk_voicemail_conf);
49 foreach ($lines as $key => $line) {
50
51 unset($value);
52 list($var,$value) = split('=>',$line);
53 $var = trim($var);
54 if ($var==$username && $value) {
55 $buf = split(',',$value);
56 if ($buf[0]==$password) {
57
58 // authenticated
59 $auth = true;
60 $mailbox = $username ;
61 $displayname = $buf[1];
62
63 $default_page = 'voicemail';
64
65 $admin_callmonitor = 0;
66 if ($callmonitor_admin_mailboxes) {
67 $mailboxes = split(',',$callmonitor_admin_mailboxes);
68 foreach ($mailboxes as $key => $value) {
69 if ($value=='all' || $mailbox==$value) {
70 $admin_callmonitor = 1;
71 break 2;
72 }
73 }
74 }
75 }
76 else {
77 $_SESSION['ari_error'] = "Incorrect Password";
78 return;
79 }
80 }
81 }
82 }
83
84 // check sip login
85 if (!$auth) {
86 $lines = file($asterisk_sip_conf);
87 foreach ($lines as $key => $line) {
88
89 unset($value);
90 list($var,$value) = split('=',$line);
91 $var = trim($var);
92 $value = trim($value);
93 if ($var=="username") {
94 $sip_username = $value;
95 }


I do not know what to change unfortunateli I never before did something about php programs,

does anybodi know what to change in order to solve this problem

thank you
2 REPLIES 2
Karl Rohwedder
Honored Contributor

Re: What to change in this program to make it works?

I think, the error message are quite useful:

a. permission denied, pls. check the persmission on the file

b. pls. check, if the file really exists

regards Kalle
Muthukumar_5
Honored Contributor
Solution

Re: What to change in this program to make it works?

check the permission with ls -l. It must be apache:apache so that web server can able to change file contents.

# chown apache:apache

hth.
Easy to suggest when don't know about the problem!