BlueGate sip GSM gateway - very bad choice

Some time ago, we bought new SIP GSM gateway for our PBX. The GSM gw is BlueGate sip GSM gateway, dual SIM (

I read in the spec that it is coming with Siemens radio module and decided that the GW will be made with high quality in mind.

Unfortunately  this was not the case and we faced our firs issue.

The operators started complaining that they hear noise during call, and despite the fact that the signal to noise ratio is very good, the noise which is heard during call is too loud and very very annoying.

The noise is coming from the radio module and the producer of the GW confirmed it, but they said that they will not do anything about it. Here is their last answer from the communication with them:

    I haven't good news. I got the BG SIP twin yesterday. I tested it with our specialist for analog signals. The moment BG SIP twin connect analog output from GSM modul we hear the noise from the GSM modul too. But we can't take out only noice incomming from GSM modul. I do nothing with it.

Until now we used Vierling GSM GW which was using ISDN to connect with PBX and we have had no problem with it, but I decided to switch to SIP and bought the crap described above.

The second issue we have had with this device, is that probably in 99% of the cases, it was not passing DTMF tones to the PBX.  We just did not get any DTMF and the clients which were calling us on these lines were not able to choose anything from the IVR menu.

Considering the issues with the noise, we did not even bothered to write again to their support, because we already knew that this device is dead for us.

As a conclusion: DO NOT buy BlueGate SIP GSM gateway from They suck.

Now we have direct land line SIP trunk with the mobile operator, and all is just fine.

How to apply OTA update or UNROOT rooted nexus 5 without loosing user data.

These days I got notification from my phone (Nexus5 with android 5.0) that I have update to android 5.0.1.

The phone is rooted without modification of the boot partition. 

I tried to update, the phone rebooted and started the update process and after a few seconds it say ERROR, and stops.

It appears that the updater checks for modifications on  system partition and if some are found, the update is stopped.

Here is how I managed to update, without flashing all back to stock and suffering the pain of reinstalling all my apps, loosing user data (if not backed up), loosing app states and so on, basically a lot of time can be lost.

The below instructions will probably work on all nexus devices with slight modifications.

All the commands which I am going to present you are tested on linux, but they should work on windows and mac too, as long as you have downloaded android SDK.
I assume that your bootloader is unlocked. If not, you can not do anything without wiping out the phone.

How to check if bootloader is locked, two ways:

1. When you power on the phone you see the GOOGLE logo. If the bootloader is unlocked you will see unlocked padlock below the google logo.
2. Switch OFF the phone, then hold for 5-6 seconds Volume Down + Power.

This will start the bootloader for you (one lying down android with open stomach :))
Below the android you will see some info, about your phone, bootloader version etc.
On the last line it says: "LOCK STATE - unlocked"  if bootloader is unlocked

1. Download android sdk.

If you do not intend to develop, you DO NOT need the "android studio", just download 'SDK tool only"

2. If undr Linus/Mac, extract the contents of the package

3. Run android-sdk-linux/tools/android. This will start GUI which will let you choose which components to install

4. Choose "Android Platform SDK tools" and hit install

5. If all went fine, you will have folder android-sdk-linux/platform-tools/ which contains the tools you need.

6. Switch On "usb debugging" on your device.

7. When you connect the phone, try this simple command:

sudo  android-sdk-linux/platform-tools/adb shell

The phone will probably pop up a dialog, asking for confirmation to allow the connection from the computer.
Hit YES and the command you executed will be drop you in a shell on the phone.
If this happens then all is good, you can continue

8. Download the stock images for your current version of android:

9. Extract the file, in my case (hammerhead-lrx21o-factory-01315e08.tgz). You will get ZIP file called hammerhead-lrx21o/

10. Extract it too and you will get the image files


11. If you want to root your phone after the update, download also:
Chanfire installable ZIP: As of time of this writing, version 2.40 (

You can see which is the latest version here:

12. Upload the file to your device, you can do this with the following command:

android-sdk-linux/platform-tools/adb push /sdcard/Downloads

This will place the file in your Download folder on the phone.

13. Download TWRP rescue image:

14. Be very careful from now on :)

15. Go in to fastboot mode by doing either power off the phone, then hit volumedown + power for a few seconds, or if the phone is on, with the following command:

sudo android-sdk-linux/platform-tools/adb reboot bootloader

This is supposed to send you in bootloader.

15. Flash stock recovery image: (you should be in the dir where the extracted images are )

sudo android-sdk-linux/platform-tools/fastboot flash boot boot.img 

reboot bootloader again
sudo android-sdk-linux/platform-tools/fastboot reboot-bootloader

16. Flash recovery image to stock

sudo android-sdk-linux/platform-tools/fastboot flash recovery recovery.img

reboot bootloader again
sudo android-sdk-linux/platform-tools/fastboot reboot-bootloader

17.  Flash the system img

sudo android-sdk-linux/platform-tools/fastboot flash system system.img

18. Reboot the device.
In the bootloader, navigate with (volume +/-) and when it shows "REBOOT", hit power to confirm, this will reboot the phone and boot android. And you now have unrooted device.

19. Apply the update, either go to settings-> about -> check for updates.
If nothing is shown there you can wait for some time and the notification will pop up again. (there is a faster method for update, but I intentionally do not show it here)

20. When the update is applied, if you want to root again the device, do the following:

sudo  android-sdk-linux/platform-tools/adb reboot bootloader

21. Flash the recovery image with the twrp image which you downloaded earlier:

sudo android-sdk-linux/platform-tools/fastboot flash recovery openrecovery-twrp-

22. Reboot bootloader

sudo android-sdk-linux/platform-tools/fastboot reboot-bootloader

23. With volume +/- navigate to menu "Recovery Mode"
24. You will see a interface with buttons.
25. Go to Install
26. Navigate to your download folder and select the file you uploaded there earlier. In current case this is
27. At the bottom "Swipe to Confirm Flash"
28. If all went fine, your device is rooted at this step
29. Reboot the phone and enjoy your root.

How to concatenate files containing columns of data in Linux

Ever wondered how to concatenate text files containing columns next to each other ?

One little bash trick which can help you do this the easy way:

Assume you have for example three files containing something like this:


a    b    c

a    b    c

a    b    c

a    b    c



1    2    3

1    2    3

1    2    3

1    2    3


m    n    p

m    n    p

m    n    p

m    n    p

What we want to achieve is the following result:

a    b    c    1    2    3    m    n    p

a    b    c    1    2    3    m    n    p

a    b    c    1    2    3    m    n    p

a    b    c    1    2    3    m    n    p

You have two options

Option 1: Try to do it in bash and die in pain. This is usually not funny.

Option 2: The easy way, use the command "paste":

[user@host ~]$ paste file1.txt file2.txt file3.txt
a    b    c     1    2    3     m    n    p

a    b    c     1    2    3     m    n    p

a    b    c     1    2    3     m    n    p

a    b    c     1    2    3     m    n    p


The command paste will concatenate the files for you

The program have some cool options, like you can set separator, or use the -s option which will cause the following behavior "paste one file at a time instead of in parallel"

Here is an example with the same files:

[user@host ~]$ paste -s file1.txt file2.txt file3.txt

a    b    c             a    b    c             a    b    c             a    b    c

1    2    3            1    2    3             1    2    3             1    2    3

m    n    p          m    n    p            m    n    p            m    n    p

Each row, becomes a new column.

Have fun :)