Asterisk no sound from client

I was running an Asterisk server behind NAT without any problems at one location. Due to reoargnization it was moved to a new location and placed behind a pfsense firewall. After a while users reported increasing problems with no sound from the clients.

It turned out running a SIP server behind a pfsense can be problematic. When moving to the SIP server to a white IP-adress (no NAT), protecting it using iptables firewall on the SIP-server, all problems disappeared.

It should be noted that the pfsense firewall was not running the latest version of pfsense so it could be caused by a problem solved in later versions of pfsense. However, for different reasons it was not possible to upgrade pfsense so the solution was to move the SIP-server from behind pfsense.

How to vertically center text in a div

This is a neat way of centering text in a div. Live demo here.

 

<html>
<head>
 <title>Vertical text center demo</title>
</head>
<body>
<style>
.textbox {
 height: 200px;
 width: 300px;
 text-align: center;
 font-size: 14px;
 font-weight: bold;
 background-color: blue;
}
.textbox p {
 height: 100%;
 display: flex; /* vertically center text */
 justify-content: center;
 align-content: center;
 flex-direction: column;
 margin: 0 50px;
 color: white;
}
</style>
<h1>Vertical text center demo</h1>
<div class="textbox">
 <p>This text is vertically centered in the box</p>
</div>
</body>
</html>

Unable to mount NTFS filesystem due to hibernation

I had retrieved a harddisk out of a broken laptop containing Windows 10 in order to retrieve some files from it. The harddisk had been removed from the broken laptop and then installed in a HDD enclosure with USB connection. When I connected it to a Windows computer I could browse the Users folder but clicking on a user’s folder displayed a message that I didn’t have permissions to open it unless I continued as administrator. After the progress bar had went to 100%, I still couldn’t access the folder.

Instead I connected it to a Linux/Ubuntu computer and now the message “The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the `ro` mount option.” was displayed when connected. The original laptop had been in a hibernate state when it broke which locks the filesystem.

It turned out that the easiest solution was to connect the USB harddrive to a laptop and press F10 to select boot device during boot up (the key might be different depending on brand, on my Samsing it was F10). I selected the USB harddisk and it booted after fixing the disk automatically. I was actually a bit hesitant to do this because I know from earlier Windows version that it usually was a hopeless task to boot on a harddisk that had been moved from one host computer to another. In Windows 10 it looks like they have fixed this.

I could log in to Windows as the original user and retrieve the files. After shutting it down in a controlled manner, it was also possible to mount the disk in Linux/Ubuntu..

Ispconfig3 unable to store client on DNS and email domain records

After upgrading from Ispconfig 3.0 to 3.1 odd things started to happen. For example, when saving a DNS secondary zone it would not store the client selected. Same thing when saving an email domian, client info and spam filter setting just would save.

The solution turned out to be simple. Gentlemen – clear your cookies and login again! Problem solved.

High load on CPU and disk I/O every hour (Apache, MySQL and mod_pagespeed on Ubuntu)

On one of my Ubuntu servers I noticed a significant peak in CPU load (load average, LA) and disk I/O about every hour. At first, I suspected that MySQL was the cause of this, doing some houeskeeping or garbage cleaning.

However, it turned out it was caused by the Apache module mod_pagespeed. The high load occuered when pagespeed was cleaning out it’s cache.

The solution was to locate the cache on tmpfs instead. This was done by editing the file /etc/apache2/mods-available/pagespeed.conf and change the location of the cache by the line (/run is located on tmpfs which is RAM memory):

ModPagespeedFileCachePath "/run/cache/mod_pagespeed/"

Then restart Apache by:

service apache2 restart

HP Procurve MSM422 / MAP-625 clients flow the dhcp server [solved]

A client was using the HP Procurve MSM422 / MAP-625 MultiService Access Point (wifi). It was being used in a rather crowded wifi environment and the problem was the wifi clients keept reconnecting and renegotioating so often that the DHCP server was overflowed, sometimes with DHCP requests every few seconds. They had been struggling with the problem for a couple of months and the focus was aimed at the DHCP requests.

It turned out that the problem was not in the DHCP negotiation at all, but was caused by the wireless clients that keept losing connection and each time when they reconnected a DHCP request was sent.

The client was misinformed, that 5 GHz band was prohibited in the country where it was set up (which is acutally not). So both radios (radio 1 and 2) where set to 2,4 GHz where radio 1 was set to 802.11n/b/g and radio 2 with 802.11b/g.

Furthermore, for radio 2 the value of the Antenna gain was set to the maximum which is 29 dBi in an attempt to boost the maximum power out of the system. However, this field works the opposite. In order to be regulatory compliant and not emit more than the allowed power, this field informs the system that it is connected to an antenna with 29 dBi gain, so to not emit illegal levels of power (output power + antenna gain), the system will reduce the actual output power (i.e. the power input to the antenna) by 29 dBi. But the system was using the internal antennas which, I guess, has more or less no antenna gain. This caused the system to actually emit -29 dBi, i.e. a very weak wifi signal.

The low power output made it hard for the wifi clients to “hear” the access point, which caused them constantly to lose connection and when reconnecting, they were sending a DHCP request, hogging down the DHCP server.

Solution:

  • Radio 1 was configured to use the 5 GHz band. This band is much less crowded than the 2,4 GHz band and the bandwidth is better, so when a client has the possibility, it is preferred if it can use the 5 GHz band.
  • Radio 2 was configured to use Internal Antenna with 0 dBi antenna gain.

Settings used when the problem was solved like this (click on the image to enhance it):

HP Procurve MSM422 MAP-625

HP Procurve MSM422 MAP-625

“Not a valid image” when trying to upload images in Joomla! 3.7

Error message “Not a valid image” displayed when trying to upload an image in Joomla! 3.7. The error message is displayed even though the file type being uploded (jpg or png for example) is existing as valid type in both valid file types and mime types fields.

Solution: Go to System -> Global configuration -> Media and select Check MIME types = No

PrestaShop 1.6 – unable to remove product from cart [solution]

If it’s not possible to remove an item from the cart in PrestaShop 1.6, try this solution:

Advanced settings -> Performance -> Move JavaScript to the end = NO

The problem seems to occur in Chrome and Microsoft Internet Explorer but not in other browsers like Firefox for example.

PrestaShop and PayPal payment error after checkout – 699 kr was paid instead of 699 kr [solved]

A client running PrestaShop 1.6.1.13 with PayPal payment module version 3.11.4 had problems after checkout of orders with an error message saying “699 kr was paid instead of 699 kr”. It turned out it was a rounding error where PrestaShop and PayPal use different methods of calculating the rounding.

The solution suggested was:

  • Go to preferences -> General
  • Rounding rule: Round to infinity when the value is halfway (recommended)
  • Rounding Type: Rounding for each element

This solved part of the problem. However, the client applied a store wide discount of 30%, causing a product (for example) costing 999 kr to checkout at 699 kr. To be precise, 999 kr minus 30% discount is 699,30 kr, but the 0,30 was rounded off. The same problem as mentioned above occured even when putting one piece of this item in the cart and checking it out.

It turned out that the theme used (jms_homewares version 1.0) only display prices in full kronor, without any decimals, independent of the settings regarding decimals in the Preferences -> General tab. In this case the settings was set to display 2 decimals. Setting it to 0 decimals solved the problem. I should mention that I am not sure if this is standard behavoiur of jms_homewares or if it has been modfied by the website developer. However, in this case setting it to display 0 decimals made everyting work without errors.

Joomla 3.7.0 error “Warning. Empty solution not allowed” when trying to save article in frontend [solution]

After upgrade to Joomla 3.7.0 an error was displayed when saving an article in the frontend. The error message was “Warning. Empty solution not allowed”.

The error message is a bit confusing, not giving any real hint what it is about. It turns out it has to do with Captcha. A new feature in Joomla 3.7.0 is the possibility to use Captcha on article editing.

To solve the problem, go to Options -> Articles and select the Editing Layout tab. Make sure “None Selected” is set in the Captcha field and click Save. Do click Save if it is already selected because it seems the setting is missing after the upgrade. By saving, the setting will be added and the problem is solved.

Joomla 3.7.0 "Warning. Empty solution not allowed"

Joomla 3.7.0 “Warning. Empty solution not allowed”