FreePBX Paid Support


Not Logged in - No Account?

Don't have an account? Registering an account with us allows you to post to the forums, easily track new posts, subscribe to threads, pm (private message) other forum members, and receive periodic news letters (you can opt out if you desire). Once you are logged in this message will no longer appear. If you don't have an account, you can create one by registering here. Lost your password, request a new password. We respect your privacy which means we collect minimal information when you register and we do not resell that information or use it in any objectionable way. You can review our privacy policy for full details.


Online update problem

clambert's picture

Is that me or other people get the Warning Cannot connect to online repository (mirror.freepbx.org). Online modules are not available. in RC1 since last night. No error in httpd or any other log. É


__________________


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Similar problem

ronald.lew's picture

I have the same issue with FreePBX. I recently upgraded from 2.2.3 to 2.3.0rc1 to 2.3.0. I believe the problem lies in function module_getonlinexml in /var/www/html/admin/functions.inc.php I removed the @ from the file_get_contents function call on line 1726. After doing so and running /var/lib/asterisk/bin/module_admin listonline from the command line, I get the warning:

PHP Warning: file_get_contents(http://mirror.freepbx.org/modules-2.3.xml): failed to open stream: HTTP request failed.

What is strange is that I can ping mirror.freepbx.org AND I can wget the xml file.


This is usually related to

p_lindheimer's picture

This is usually related to proxy issues. If not and you are using trixbox, I believe they had some problems on their ISO configuration wrt to DNS or something.
------------------------------------
Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


This can also be down to

paulkoan's picture

This can also be down to your php configuration.

The method freepbx uses to download the modules file is via a file open command with a url as parameter. A "secure" php configuration will not permit this, so your apache php.ini would need to be modified to allow:

allow_url_fopen = On


I have same problem, i check

wp1998's picture

I have same problem, i check php.ini , allow_url_fopen = On , but check for update online failed.

Warning: Cannot connect to online repository (mirror.freepbx.org). Online modules are not available.


Hello wp1998 The first thing

paulkoan's picture

Hello wp1998

The first thing to check is if you can get the file at all - so try

wget http://mirror.freepbx.org/modules-2.4.xml

from the freepbx server (swap 2.4 for the main version you are running).

If this works, then it eliminates dns and firewall type causes, so then you may have a permissions issue...


not quite - it does not

p_lindheimer's picture

not quite - it does not eliminate content filtering. Sonicwall firewalls are famous for creating this problem when content filtering is enabled, and I assume there are others that also have the problem.


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


Are you saying that a

paulkoan's picture

Are you saying that a successful wget of the xml file from the box that runs the script that downloads the same file doesn't eliminate the firewall as an issue?

How does the sonicwall filewall know that the server is running wget versus a php script?


Because the sonicwall is

KodaK's picture

Because the sonicwall is doing content filtering. It's looking at the data in context and doesn't like something that's happening in context.

Seriously, sonicwall does this a lot. (As do other content filtering systems, but sonicwall is the one that comes up the most.)


Yeah I was aware of the

paulkoan's picture

Yeah I was aware of the sonicwall issues, but I had figured that PHP and wget would send a similar parameter set with the http get, and both be incomplete compared to a browser doing the request.

So I would have expected the wget to fail in the same way as the php "fopen with url". Perhaps wget then sends a more complete set of headers if it does work correctly.


Any other ideas?

tabbertmj's picture

Does anyone else have any ideas on this? I have one trixbox 2.4 install that FreePBX will load updates on. Then I tried the PIAF, that one will not update. I can ping the mirror.freepbx.org on both. Other than the Ip address, all other network settings are the same. I'm not a Linux person, so I haven't been able to find the php.ini file. Could somebody shed some light on where I could find it please???

Thanks,
Mike


Same problem. I can

dizel247's picture

Same problem.

I can download wget and xml file. But cannot use online admin. Any help please?

Roman


@Mike: The php.ini is often

paulkoan's picture

@Mike: The php.ini is often at /etc/php.ini - try "locate php.ini"

If not, what distribution of linux are you running?

@Roman

If you aren't running a Sonicwall firewall, then this can be a permissions thing. Do you know which user your web server is running as?


hello thanks for your

dizel247's picture

hello thanks for your help.

As per instruction I changed in httpd.config
User asterisk
Group asterisk

When i try your test script I get an empty page.

How do I check what user its running under?

Should I wipe the install and redo everything ?

Roman


Thank you Paulkoan. I

tabbertmj's picture

Thank you Paulkoan. I found it. I went and looked at it in nano, I did find an entry for allow_url_fopen. It was set to On.
This is an install of CentOS 5 from the pbx in a flash cd.

I'm still at a loss on this one.


Hello tabbertmj, Did you

paulkoan's picture

Sorry, forgot to put that

tabbertmj's picture

Sorry, forgot to put that in. Yes, I can use wget to download the file manually. I then went back in to FreePBX and tried again. No luck. I think I might try this weekend on another machine to see what the results are.


Hello. Try this. Create a

paulkoan's picture

Hello. Try this. Create a file called test.php in your htdocs directory (this may be at /usr/local/apache/htdocs, it depends on your dist):

<?php
$data = file_get_contents("http://mirror.freepbx.org/modules-2.4.xml");
echo $data;
?>

Run this from the command line and make sure you get the modules list:

php test.php

Now browse to your freepbx webserver and see if you get the modules list:

http://yourwebserveraddress/test.php


test.php didn't work.

raymondpau's picture

Running test.php produced the same error - "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"

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


Hello Roman If you run

paulkoan's picture

Hello Roman

If you run

php test.php

from the command line, do you get any errors?


Hello, I have reinstalled

dizel247's picture

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

dizel247's picture

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

paulkoan's picture

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?


Check out Tadpole's response

jsobell's picture

"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


This Works for my, to

Cangrejo30's picture

Hi, this change user_agent in the php.ini, works for my, I Do this change, restart httpd and amportal, run egain the process for update, and I cant get then.

Cangrejo


Warning: Cannot connect to online repository (mirror.freepbx.org

virtuallyanywhere's picture

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.


Sonicwall Issue

paulkoan's picture

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

ronald.lew's picture

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.


its an apache problem! think i found the solution

tremorpheus's picture

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 :)


RE: its an apache problem! think i found the solution

WebMaxtor's picture

all you need to do is set HostNameLookups on in /etc/httpd/conf/httpd.conf

I suggest those struggling here verify this setting. After verifying netcconfig, pinging urls, file access via wget, etc., this change with a stop and restart of Apache works for me.

Could anyone with better knowledge of BIND comment on any ramifications of this change in Apache verses any more encompassing DNS configuration or problem? Although it works, I am interested if this is a best practice going forward.

Sorry I gave up on my search

dizel247's picture

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


dizel247 wrote:

p_lindheimer's picture
dizel247 wrote:
I guess this issue need to be research more carefully by freepbx team and create some work around.

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.


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


I would imagine that the

paulkoan's picture

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

p_lindheimer's picture

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.


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


The problem is RESOLVED for me

ksskruthic's picture

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


Problem RESOLVED

cashmoneybaby's picture

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


Resolved

Jonathan Galpin's picture

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.


Online Update Problem - php fsockopen & proxy server to blame?

cdel's picture

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.


Same problem continues...

root's picture

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


Extension Voice message

mavinod's picture

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


Vinod, Please, please do not

fskrotzki's picture

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.


I've seen this oddity

jroper's picture

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


I have two production

bluetrepidation's picture

I have two production servers behind Sonicwalls here. We recently updated our Sonicwalls to the new version of advanced OS. (3 to 4) Since then I can't get updates on either of my machines. I've tested using wget and the xml file loads with no issues. The php script simply cannot connect. I've tried all of the hacks listed here. Even the code that supposedly loads using wget commend. Nothing helped. The code hacks broke FreePBX, nothing would load. The only way I can load updates is to plug the server into the outside world on a static IP. This isn't exactly possible on a production server. Keep in mind content filtering is turned off here. Is there any other way to get updates or load modules?


The following fixed my

bluetrepidation's picture

The following fixed my issue:

On October 26th, 2007 nathan31415 (tadpole) said:

I had the same problem tonight though I have a Sonicwall TZ170 running the Enhanced OS.

The solution is described here:

http://www.radiotope.com/writing/?p=95

In short, the CFS engine is running no matter if you have a license for it or not and the firewall is dropping only the HTTP GET packet (though the earlier SYN/SYN-ACK packets go through fine). You have to manually disable the CFS engine via the undocumented http://your.ip.address/diag.html URL after logging in.

My guess is that the short HTTP GET packet causes the CFS engine to drop the packet. Wireshark showed only

HTTP GET /modules-2.3.xml HTTP/1.0\r\n

with no other accompanying parameters as you typically find when a true browser does an HTTP GET (e.g. Host:, User-Agent:, Accept:, Keep-Alive:, Connection:, Referer:, Cookie:, Authorization:, etc. etc.) followed by TCP retransmissions (since no ACK was ever received back from freepbx.org). A wget of the the URL worked just fine from the same IP address so I'm not sure what else the Sonicwall triggers on, but I was stumped (and no mention of the "...examining stream for host header" message on either sonicwall.com or mysonicwall.com that I could find, sigh).

If FreePBX faked some of the additional fields when issuing the GET I bet the packet would pass through the Sonicwall just fine. I could see a security-paranoid web proxy do the same thing too (I wonder how you could force Squid to do this?).

Nathan


Good sujestion

elisnaldo's picture

hei ronald,

good sugestion on August 29th, 2007. I make your sugestion and vary good result! Thaks


Sonicwall Resolution

dkwiebe's picture

Thanks bluetrepidation. That solved my problem!


I found a Solution, I hope it should be implemented

otbl's picture

I found the following article:

http://bugs.php.net/bug.php?id=29280

The issue is that php use a defaul streaming context that not includes any proxy you have to set it up manualy in "/var/www/html/admin/functions.inc.php"

$opts = array('http' => array('request_fulluri' => true, 'proxy' =>'tcp://192.168.0.1:8080'));
$context _stream = stream_context_create($opts);

That create a new context using proxy address.

These 2 line should be present before each file_get_contents invoking an URL or fopen for retrieving modules.

Also you need to modify each file_get_contents and fopen adding ".false,$context_stream" as leadin parameters

Add the following 2 line at the top of these functions :

function module_getonlinexml
function module_get_annoucements
function module_download
function _module_readxml

Near line 1725 :

change : $data = @ file_get_contents($fn);
by : $data = @ file_get_contents($fn,false,$context _stream );

Near line 2929 :

change : $announcement = @ file_get_contents("http://mirror.freepbx.org/version-".getversion().".html".$options);
by : $announcement = @ file_get_contents("http://mirror.freepbx.org/version-".getversion().".html".$options,false,$context _stream);

Near line 2335:
change : if (!$dp = @fopen($url,'r')) {
by : if (!$dp = @fopen($url,'r,'false,$context _stream)) {

Near line 2705 :
change : $data = file_get_contents($xmlfile);
by : $data = file_get_contents($xmlfile,false,$context_stream);

It should not be too difficult to add this code in the source of freepbx and adding the proxy parameters in the general tab of the configuration.


Please post this as a bug

fskrotzki's picture

Please post this as a bug with your fixes. That way it will get tracked and addressed versus getting lost here in the forums.

Thanks.