Asterisk streaming music-on-hold

In Asterisk it is possible to upload .wav or .mp3 files to be used as music-on-hold (MOH). Another option is to use streaming audio but using a stream from a Shoutcast server requires some hands on.

This is how I did the setup for AsteriskNow 1.7 with FreePBX 2.9.

First of all you will need mpg123 from to get the Shoutcast stream from the Shoutcast server.
If you already have gcc on your system you can skip the first step.

yum install gcc
bunzip2 mpg123-1.13.4.tar.bz2
tar xvf mpg123-1.13.4.tar
cd mpg123-1.13.4
make install

Login to admin of your AsteriskNow / FreePBX server and go to Setup -> Music On Hold. Click on Add Streaming Category. Enter the following: 

Category Name:   radio
Application:     /usr/local/bin/mpg123 -q -s -r 8000 -f 8192 -b 2048 --mono
Optional Format: 

Most Shoutcast streams are sampled at 44.100 kHz or 22.050 kHz in stereo. In order to use a stream for MOH in Asterisk it must be converted to 8 kHz mono, hence the parameters -r 8000 -f 8192 and –mono.

The IP-address and port 8000 in the example should be replaced by the real ip-adress (or hostname) and the port number of the Shoutcast server you want to stream from.

In order to test the streaming music-on-hold, the easiest way is to set up a dummy extension (extension 446 in this example).
Edit extensions_custom.conf and add the lines below: 

nano -w /etc/asterisk/extensions_custom.conf

exten => 466,1,Answer
exten => 466,2,SetMusicOnHold(radio)
exten => 466,3,MusicOnHold()
exten => 466,4,Hangup

Save it by pressing CTRL-X and respond Y.

Now login to admin of your AsteriskNow / FreePBX server and go to Tools -> Custom Extensions. Click on Add Custom Extension. Enter the following: 

Custom Extension: 466
Description:      radio

And then click Submit Changes.

Don’t forget to click the orange Submit Configuration Changes in the top of the screen.

If all works as planned you will hear the streaming Shoutcast station when you dial extension 466.

Ubuntu 9.10 package mysql-server-5.1 5.1.37-1ubuntu5.1 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1

When trying to do an apt-get upgrade the MySQL package failed with the error message:

package mysql-server-5.1 5.1.37-1ubuntu5.1 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1

The problem is that the start / stop script for MySQL fails to stop the running MySQL server before upgrade.


apt-get update
ps ax | grep mysql

Now kill each process that has to do with MySQL.

apt-get upgrade

Voila – now it works and MySQL gets upgraded.

WordPress Media crop button greyed out

In WordPress Media it is possible to edit the images in some basic ways including cropping. To use the tool you must fist make a selection in the image by clicking and dragging across the image. The selection must be wider than the smallest image setting in WordPress. Otherwise the crop tool will stay greyed out. Once a large enough selection has been made the crop button becomes clickable. This is not always logical to the user who often try to click the crop button first.

Cropping images in WordPress

Navigating with HTC Locations

HTC LocationsWhen I bought my latest smartphone, HTC Desire HD, a navigation software called HTC Locations was preinstalled. HTC Locations is a product by HTC but navigation and maps is powered by the well known Route 66. 

It is free to download maps but to be able to navigate in an area you must buy a navigation license. Additinally you can also buy license for traffic information and speed cameras. The navition for Scandinavia came with a 30 day free trial. After a bit of testing I decided to buy navigation for entire Europe, life time updates. It is a big plus that all maps are on the SD memory so you don’t need a data connection to use it.

After a couple of months of use there are some issues with the software (which I have reported to HTC).

  1. A feature I miss from other navigators is to set a town centre as destination. If you are going to a large city for example, you might not know a street name you want to go to. You just want to get into the city centre. This is not possible in HTC Locations. You must enter a street as your destination. Picking one at random and your target is a larger city, you risk ending up in some suburb.
  2. I bought the navigation license with my Swedish SIM in the phone. On a trip to Italy I put an Italian SIM in the phone. Doing this the navigation did not work unless I put my Swedish SIM back in. HTC has not yet responded to my question about this.
  3. Zona Traffico Limitato and video camerasOn a trip in Italy from Bergamo to Tortona the route goes by Milan which is a major city. Milan has a circular motorway surrounding the city ("tangenziale") in order to lead traffic outside the city centre. HTC Locations however, routed me straight through the city centre. Worse is that in larger cities in Italy they have ECO-zones. Without a permit you will get a fine if you drive into an ECO-zone. The streets are monitored by video cameras and fines are sent to you by mail, even to foreigners. HTC Locations tried to lead us straight through the Milan ECO-zone. Luckily enough I spotted the ECO-zone signs so I manually could avoid it. A couple of days later a similar thing happened in Torino where the navigator tried to lead us through a traffic limitation zone (ZTL, zona traffico limitate) even though our destination address was outside the ZTL.
  4. When going from Münich in Germany to Venice in Italy HTC Locations routed us through the alps on small, beautiful roads. The trip took several hours longer than calculated because the calculations are probably based on the speed limit of the road. Even though the limit is 80 km/h it is impossible to keep that speed on narrow serpentine roads. The roads should probably be encoded with lower speeds so the navigator will make the route on larger roads.
  5. Several times when waiting for a red light the HTC connected to an open Wifi hotspot. When doing so the navigator exited the map mode to the menu, loosing the destination. I quickly had to reselect the destination from the history to contine the navigation. Once it had found my position and recalculated the route to the destination, the red had turned to green and the Italians behind had started honking their horns a long time ago.

Apart from that I think the navigation works well and it is very practical to have a good navigator in your phone. To be able to use it as a navigator (opposed to buying a separate product) you will need a car mount and a car charger. 


A nerd’s survival kit – extra power for your smartphone

PowerPackThe arrival of the smartphone (iPhone, Android) etc is a blessing for the true nerd who now can be constantly online and up to date with important things (aka the Internet). On a professional level it is a way of giving good service to your customers be being able to quick reply to emails etc.

The problem with the smartphones are battery capacity. With a couple of apps running and checking things now and then you can easily be drained in 2-3 hours. For an upcoming trip abroad I started to investigate solutions. I looked at solar cell chargers which turned out to be quite big in order to supply sufficient current. They also have built in batteries. Since I will not be hiking in the himalayas I figured the thing I really needed was extra battery capacity. I will after all stay in hotels where there is possibility to recharge over night.

PowerPackMy choice fell on a 5 Ah PowerPack from One thing to investigate thoroughly before choosing the pack is that it can deliver enough current to charge the smartphone. It will require at least 1 A and there are power packs on the market with lower current ratings supposed to be used only with MP3 players and similar. If you want to do this stunt with an iPad you need even more current (2 A).

First I tried to use up my phones battery and then hook it up to the powerpack to recharge it. This wasn’t a good idea since a dried out smartphone will consume too much current which the powerpack can’t deliver. So instead, already in the morning when leaving my hotel, I hooked the smartphone up to the powerpack and run it on both the internal battery and the powerpack. This way my power lasted for the entire day.

When abroad I don’t have data roaming (otherwise the charges would be sky high). There is a little smart Android app called WeFi. It runs in the background and scans for open hotspots and connects to any it finds, no matter if it has an SSID that is not already known by your device. Once hooked up it verifies if it has Internet connection and plays a little sound. Then your phone pulls down new emails etc. Just walking by for example a McDonalds and you’re all up-to-date again 🙂

Mobile Internet in Italy by

Passa a windI recently went on a trip to Italy and in order to keep up to date with work I decided to find some prepaid mobile Internet for my stay. I stepped by a Wind ( store in Verona on a friday afternoon. The attendant explained that my best choice would be their "Mega unlimited" offer which included a SIM-card for a total of 30 euros (10 euros for the SIM-card and 20 for the internet). As I have a built in 3G modem in my laptop and a HTC Desire HD smartphone a SIM-card was the only thing I needed. The APN for Wind is internet.wind and the number to dial is *99#.

I was told that I had to wait to the day after until some SMS in Italian had been recieved before I could start using it. Before I left Italy I should also send a text "ESTERO NO" to nr 4033 to cancel the subscription (it is actually a subscription that would cost 4 euros a month after 6 months). So, a couple of SMSes in Italian arrived and off we went! It worked perfectly to surf on the net and check my email and speed was good. A couple of hours later I tried it again. But this time no luck. It seemed that the network wasn’t accepting my SIM-card.

So I moved it from my laptop over to my smartphone and tried it there with the same result. At this point I also could get online temporary on a Wifi-network so I checked the website, but there was no means of getting in touch with them by email. Wind has a free customer service number, 155, which can be reached from the mobile. This worked but on a weekend there was nobody speaking english available. I could understand "lunedi" which is monday, so I had to call back after the weekend.

On monday I again tried 155 and now there was a choice in the phone menues to switch to English (which ironically enough was said in Italian but somehow I figured out which dial to press to make the voice switch over to English). Now I could reach an english speaking customer service assistant who could inform me that the reason to my SIM not working is that the account balance is zero. And when it is zero all services are turned off. Trying to explain that I already payed 20 euros for the internet service wasn’t helping. At least I needed to add 5 euros of airtime which can be purchased in any tobacco store or online. Unfortunately she "forgot" to inform me that the smallest online recharge amount is 15 euros. So off to a tobacconist to buy 5 euros of recharge, add it to the account and voila – everything has been working like a charm since.

In total, for 35 euros, I have a month of unlimited mobile Internet in Italy (including the 5 euros of recharge needed, which the attendant in the Wind store in Verona "forgot" to inform me about) which I think is worth the money. When not using it in my computer I put the SIM in my smartphone making it possible for me to have full Internet access all the time. Even though my stay in Italy was only 10 days I think it was worth it. Sadly enough, I could only use it for 7 because of the attendant in Verona who "forgot" to inform me that I had to recharge it with 5 extra euros (which could be resolved on the monday with customer service). But that wasn’t the only thing "forgotten" to inform us about during our stay in Italy. Being ripped off 8 euros per icecream in a gelatteria in Milan just because we sat down and didn’t take them with us is another. And the only prices advertised was the take away prices (of course). But that is another, non-technical story… 🙂

Italian power plugAnother small travel tip regarding Italy. Don’t forget power adaptor if you are going to use a grounded power plug (like the ones for laptops for example) since the grounded outlets in Italy is not the european standard. If you forgot the adaptor and are staying at a hotel, check the tv power cord. TVs often have european power plugs connected with an adaptor and choosing between running the computer and watching Italian dubbed tv the choice is easy 😛  Don’t forget to put the adaptor back before you checkout though 😉 Non-grounded power plugs, like mobile phone chargers, etc, will work without an adaptor.

VMware vSphere client 4.0 crashes when trying to upload a file to datastore

 Suddenly my VMware vSphere client version 4.0.0 started to crash when I try to upload a file to the datastore. This happens on both my Windows Vista and XP boxes running the VMware vSphere client.

The problem is similar to the one described in this KB article concering Windows 7 clients. However, the solution is the same. The VMware vSphere client does not crash if it is started by right clicking and runing it as administrator.

Getting “An error occurred while updating object. lang ()” in PrestaShop

If you get the error message "An error occurred while updating object. lang ()" when updating a language in PrestaShop, this is caused when the system doesn’t have permissions to write in the .htaccess-file in your root directory.

If the file does not exist, just create an empty .htaccess-file and make sure it is writeable by the user running the webserver process, for example by issuing: 

chmod 666 .htaccess

Moving a PrestaShop 1.4 webshop

 When moving a PrestaShop version 1.4 webshop to a new domain name (from a development server to a live site for example) you must do the following: 

  1. Make sure all directories are writeable according to the PrestaShop installation instructions.
    Don’t forget that the files in config directory must be writeable as well as the entire cache directory structure. All files and directories in tools/smarty/compiletools/smarty/cache, tools/smarty_v2/cache and smarty_v2/compile must also be writeable.
    Internal server error 500 is a sign that these directories or files are not writeable.
  2. Update the file config/settings.php regarding PS base URI (if that will change) and the database settings.
  3. After importing the database on the new server use a tool like phpMyAdmin to access the database.
  4. Login to the Back Office of your shop on the new domain and go to Settings -> SEO & URLS and update the domain name for the shop (two fields). If this is not successful use the steps 5-7, otherwise go to step 8.
  5. Find a table named ps_configuration.
  6. Find the records PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL
  7. Update the values with your new domain name. You should enter just the domain name, no leading http:// or trailing path to subirectories (if your shop is located in a subdirectory, that should be entered in the PS base URI in step 1).
  8. If you use .htaccess and robots.txt files, go to Tools -> Generators and regenerate them.