Online update problem

Hello,

I have reinstalled the whole installation using the instraction provided on the freepbx.org centos 5

Same problem.

Here is the result of the test you requested.

[root@localhost html]# php test.php
PHP Warning: file_get_contents(http://mirror.freepbx.org/modules-2.4.xml): failed to open stream: HTTP request failed! in /var/www/html/test.php on line 2

This is my ping result

[root@localhost html]# ping mirror.freepbx.org
PING mirror.freepbx.org (69.41.162.148) 56(84) bytes of data.
64 bytes from 69.41.162.148: icmp_seq=1 ttl=49 time=63.3 ms
64 bytes from 69.41.162.148: icmp_seq=2 ttl=49 time=62.1 ms
64 bytes from 69.41.162.148: icmp_seq=3 ttl=49 time=61.7 ms
64 bytes from 69.41.162.148: icmp_seq=4 ttl=49 time=61.8 ms
64 bytes from 69.41.162.148: icmp_seq=5 ttl=49 time=62.8 ms
64 bytes from 69.41.162.148: icmp_seq=6 ttl=49 time=62.3 ms

mirror.freepbx.org ping statistics —
6 packets transmitted, 6 received, 0% packet loss, time 4999ms
rtt min/avg/max/mdev = 61.707/62.374/63.374/0.599 ms
[root@localhost html]#

Going even further I have another system runs on the VMware partition. I don’t have an issue with online modules. I have compared following files on both systems.

httpd.config
php.ini
amportal.config

No difference in files at all. Can someone recommend what’s casing the issues.

Roman

And wget definitely works?!

This is the same error as you would get if the “allow_url_fopen” was set to “off”… this isn’t the case, but it still points the finger at php as the culprit.

Is the vm in the same network as the failing machine? Are they running the same OS? Do they have they same version of php installed?

Are you running many web servers on the machine?

"Changing the user_agent in /etc/php.ini solves the problem.
user_agent=“Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”

This also worked for me.

If you are using IPCop anywhere in your outbound links, you may have default restrictions on the user agents allowed to send requests.
If you set this to emulate IE then this is obviously a default browser.

A strange issue, but this caught me out too.

Cheers,
Jason

I’m very new at this but encountered the same problem as everyone else. Warning: Cannot connect to online repository (mirror.freepbx.org). Online modules are not available. And I have a high spped connection with a Sonicwall router. I tried to reinstall the server from scratch - same problem. I even tried to connect my Asterisk server to a router that has absolutely no firewall - same problem. Then I installed the server again - this time when I went to connect to get the module updates *** IT WORKED ***.

So I don’t know why or how but it resolved the issue. When you do the original installation it must be connected to the internet and not through a Sonicwall. Or at least that’s what seems to resolve the issue.

I’m sure someone with much more knowledge of Asterisk, Trixbox, and Linux can determine the reason and let us all know.

Hope this is of some help.

Hello virtuallyanywhere,

The sonicwall problem is referred to further up this thread and in detail in other threads.

The solution posted is to turn off content filtering in the firewall. The Sonicwall appears to not like the minimal headers that php sends when GETing a web page, so the connection never gets through.

Like what everyone have said, it’s either a Sonicwall Content Filter or DNS problem. For those of you who can ping and wget just fine but PHP cannot fopen, then you can hack /var/www/html/admin/functions.inc.php to use wget. Here’s the snippet of code I added:

Add this to function module_getonlinexml near line 1725:
if ($override_xml) {
$fn = $override_xml.“modules-”.$matches[1].".xml";
} else {
$fn = “http://mirror/freepbx.org/modules-".$matches[1].".xml”;
// echo “(From default)”; //debug
}

//************ hack starts here ************
if (file_exists(’/tmp/freepbx’) == false)
mkdir(’/tmp/freepbx’, 0774)
$modules_name = basename($fn);
system(“wget $fn -O /tmp/freepbx/$modules_name”);
$fn = “/tmp/freepbx/$modules_name”;
//************ hack ends here ************

//$fn = “/usr/src/freepbx-modules/modules.xml”;
$data = file_get_contents($fn);
$module_getonlinexml_error = empty($data);

Add this part to function module_download around 2325:
if (!($fp = @fopen($filename,“w”))) {
return array(sprintf(_(“Error opening %s for writing”), $filename));
}

$headers = get_headers_assoc($url);

//******* hack starts here ***********
$dl_module = basename($url);
$system(“wget $url -O /tmp/freepbx/$dl_module”);
$url = “/tmp/freepbx/$dl_module”;
//******* hack ends here ***********

$totalread = 0;

This is simply just a temporary solution to have PHP use the system’s wget instead of fopen.

Sorry I gave up on my search and installed trixbox. I really didn’t want to go that route but I got really frustrated without finding a solution. Quick ISO download installation FreePBX works with out any hiccups. Best of all “HEADACHE FREE”. I guess this issue need to be research more carefully by freepbx team and create some work around.

Just to samurize.

I have installed my FreePBX using centos 5.1. I used yum to install apache, php and mysql. I did not do anythink outextrodanary. The only thing I would like to mention that my problem freepbx install was done on AMD mashine. I am not sure if that could of cased anything. Other then that I am complitely puzzeled on what was the issue. I can redo all the install one more time and let someone access it to learn what is happening. Waiting for reply is someone is interested.

Roman

After getting partial success reading this thread, such as test.php revealed it was a DNS lookup failure and some success with ronald.lew’s hack (get the xml file but syntax error on the download hack) i finally checked Apache config using webmin - basically it was set to never do name server lookups!

fix that and all’s well…

all you need to do is set

HostNameLookups on

in /etc/httpd/conf/httpd.conf

sorted :slight_smile:

trixbox does nothing more then setup an ISO and install FreePBX as is and ironically most issues of this sort are reported by trixbox users). It is not a FreePBX issue. The closes ‘culprit’ that is our issue is how we pull the xml file using a php mechanism that is known to create problems with some filtering techniques such as has been mentioned by sonicwall. Some day we may investigate changing that although you would have hoped after over 2 years of the same mechanism being there, some one out in the community might have submitted a patch that uses a different http access method in php to pull those files that would get around that problem that we could look at.

I would imagine that the reason that the patch has never been worked up is because for each of the causes identified:

  • Sonicwall Content Filtering
  • allow_url_fopen
  • HostNameLookup

There is a workaround in place. Applying the workaround has a quicker solution path for individuals, but doesn’t help the project too much.

The issue I found, which I decided that there wasn’t a quick fix for is with regards to permissions. The web server needs to run with the permissions of asterisk to modify the asterisk config files. However, I am running several services under apache, and do not want them to be run as asterisk, nor to I want to change the permissions of the asterisk files to match the user:group of apache. My workaround for this was to run lightttpd concurrently with apache, dedicated to freepbx.

What I need to do is investigate a combination of fcgi and suexec to fix this, which I will do when I get time.

But back to the patch - the “allow_url_fopen” problem can be resolved by using curl (and curl should be used anyway), but given that a significant number of people are getting this issue because of sonicwall, it would be good to understand what it is that sonicwall needs the request to look like before it will pass the request, before constructing a curl patch to make sure the two most common reasons for the problem are both fixed.

What I haven’t seen is a definitive reason for sonicwall dropping the connection. Some have found the useragent string is enough, but is that all?

as far as permissions, the real reason apache ‘must’ run as asterisk is because of the 600 permissions that asterisk sets (or at least used to) on some of the voicemail files. Tools like ARI would not be able to access them - group permissions don’t help.
As far as using curl to fix the content filtering issues, I don’t know. It has been a while since I looked at the issue, but I thought there was more than the user agent causing problems with the sonicwall content filters. Whether using curl would fix the issue, I don’t know. But with curl, the user agent could also be changed to IE or FF IIRC - been a while since I did anything with Curl.

Hi,
I am using latest PIAF 1.1. I tried all the methods but neither worked. But as I am reading through the posts I somehow thought that it could be an Apache problem. So I logged into Webmin as root and went into “servers”. Tried different options on Apache but neither worked. I just clicked “Apply Changes”, “Stop Server” and “Start Server” to the right of the screen in that order…

Then I went into “Bind DNS Server”. There were 3 options and the second option was already selected… something like “Use this server as the DNS server…” Then there was a button right below that said something like "Primary configuration file does not exist. Create one and proceed ". Once I clicked on it… everything went fine and I am on a new screen that shows me different options like “Global Server Options”, “Existing DNS Zones” etc.

Now I went back and logged into freepbx -> “Module Admin” and clicked “Check for updates online” and this time IT WORKED !!!

So bottom line… I believe its with the Bind DNS Server. Hope this helps all you people out there.

Thanks,
Sonu

These 2 things are what solved my problem:

i finally checked Apache config using webmin - basically it was set to never do name server lookups! So I logged into Webmin as root and went into "servers". Tried different options on Apache but neither worked. I just clicked "Apply Changes", "Stop Server" and "Start Server" to the right of the screen in that order..

After I made the hostname lookup change in Apache, I needed to apply changes. then stop and start Apache. Then it worked!!! Yay!

Great forum.

-cash

Tried the php and httpd changes, but they did not work.

Found I could not ping yahoo, so it was a dns issue

ping yahoo

edited resolve.conf

nano /etc/resolv.conf
to this only (open dns):
nameserver 208.67.222.222

Then restarted apache:

service httpd restart

And that fixed it.

For those that are having issues although everything appears to be correct…

functions.inc.php appears to use fsockopen to initiate it’s request to the site. (I’m new to freepbx, but I’ve worked with PHP a bit)

Natively fsockopen does not support proxying. If you are behind a web proxy then you would need to code for that, there are samples on the PHP web site under that function. If you can punch a hole in your firewall to allow the traffic then you may be fine, if not then you will need to find another method or mod the code.

I have been trying to update the modules , after trying all types of ways that have been mentioned. But the problem is still here, I can ping the webaddress, and after removing the sonic firewall the updates still made the same error message. Not sure where I also changed the Sonicwall Content Filtering disable

  • allow_url_fopen Yes
  • HostNameLookup Yes

and the problem the message still seem to apear. I f anyone has another solution please respond.
Thanks

Hi ,
can i configiure my in my SIP setting as when i dial on one particular extension .it sholul prompt me with a voice message saying " Press 1 for Helpdesk, Press 2 for Sales ectt…
if so how it can be done .were you find the setting for this

Thanks
Vinod

I’ve seen this oddity before, and I think sometimes it is caused by netconfig - hence the solution with DNS working above.

If you must use netconfig, enter the details, submint them and reboot. type netconfig and enter the details again, and reboot, then check you can check for online updates.

The problem does still occur with sonicwall firewalls, or if there is a proxy server in the way, so it may not be the solution in every case.

Alternatively, you can use the command system-config-network, and set the DNS manually.

Joe

Vinod,

Please, please do not hijack a tread about one thing to ask a question about something totaly unrelated to it. It is the best and fastest way to NOT get your answer. There are those of us who when we have time read all the postings but 90% of the people here do not and will only respond to questions that the subject of the initial post is something they are interested in or are willing to help out on. So your dialing problem will be missed by most people who would know the answer because this thread you decided to use is about online update problems.