Configure Firefox to handle callto links in Ubuntu/Debian

Hi all ūüôā

in this post I will show you how to configure Mozilla Firefox to handle callto links. By default if you click on callto link in Firefox shows the following error:

The address wasn't understood

Firefox doesn't know how to open this address, because the protocol (callto) isn't associated with any program.

You might need to install other software to open this address.

These steps are tested on Ubuntu 12.04 LTS i386, Ubuntu 13.10 i386 and Debian Wheezy amd64.

1. Install SFLPhone Software for VOIP calls

apt-get install sflphone-gnome

2.¬†Start the app. First time you will see this screen. Just click ‚ÄúContinue‚ÄĚ:

SFLPhone

¬†We need to choose ‚ÄúRegister an existing SIP account‚ÄĚ on the next screen and click ‚ÄúContinue‚ÄĚ:

SFLPhone

¬†On the next screen we choose ‚ÄúSIP‚ÄĚ and click ‚ÄúContinue‚ÄĚ:

Here we need to fill our data:

Alias: Our name
Host name: Our SIP Server IP
User name: Your user or ID
Password: Your password

¬†After filling the required data, click ‚ÄúContinue‚ÄĚ:

¬†On the next screen just click ‚ÄúApply‚ÄĚ. We don’t need to setup anything here:

 Next you will see summary for your account.

 4. Save this script to /usr/bin/sflphone-handler

#!/bin/sh
#
# This script can be used as a callto: (or other) protocol handler in
# Mozilla Firefox-based browser.
# In Firefox use Preferences > Applications and set the callto handler
# to this script.

# Test if a SFLphone client is already open, if not open a new one
# Opening a new client will start sflphoned if not already running
SFLPHONEC=`ps -A | grep sflphone-client`
if [ "$SFLPHONEC" = "" ]; then
    /usr/bin/sflphone-client-gnome&
fi

# Check 1st argument (phone number)
if [ -z $1 ]; then
echo "Error: argument 1 (phone number) not provided."
    exit 1
fi

# Cleanup destination, keeping numbers only
TO="`echo $1 | sed -e 's/[^0123456789]//g'`"

# Generate call id.
CALLID=${RANDOM}$$

# Dbus placeCallFirstAccount method does not reach sflphoned if starting
# Should find another way to do this
sleep 1

dbus-send \
    --type="method_call" \
    --dest="org.sflphone.SFLphone" \
    "/org/sflphone/SFLphone/CallManager" \
    "org.sflphone.SFLphone.CallManager.placeCallFirstAccount" \
    string:"$CALLID" \
    string:"$TO"

exit 0

# EOF

 Or you can download it from:

https://github.com/LukeCarrier/sflphone/blob/master/tools/mozilla-telify-sflphone/sflphone-handler

5. Make this script executable:

chown root:root /usr/bin/sflphone-handler
chmod 755 /usr/bin/sflphone-handler

6. Add callto handler

sudo echo "x-scheme-handler/callto=sflphone.desktop" >> /usr/share/applications/defaults.list

7. Configure SFLPhone to accept parameters

nano /usr/share/applications/sflphone.desktop

and change

Exec=sflphone-client-gnome

to

Exec=sflphone-client-gnome %u

8. Configure Firefox

Open Firefox and click on callto link. First time you will see this screen:

¬†We need to click ‚ÄúChoose‚ÄĚ and navigate to /usr/bin/sflphone-handler.

Then check ‚ÄúRemember my choice for callto links‚ÄĚ and click ‚ÄúOK‚ÄĚ.

After a while SFLPhone application should start and automatically call the number from the link.

How to delete metadata left from LSI 3ware controller

We have many servers with hardware controllers like LSI 3Ware. From time to time disks degrade and we have to change it with another one. However we found a little problem when trying to use unwiped disk in LSI 3ware controller, which was previously used in another 3ware controller. The following error appears in the disk status – Unsupported_DCB.

LSI 3Ware stores the RAID information on the disks. The main advantage is that we can replace controller without having to reconfigure it. That information is stored on a section called Disk Control Block (DCB). There are two versions of DCB – on both of them the information is stored at the end of the disk. DCB appears to be 1024 LBAs long (1024 * 512 bytes per sector = 512KiB). Additionally in one of the versions there is a copy of the DCB as the first 1024 LBAs of the disk.

So we have to wipe that info before replacing disk from one controller to another. Here’s a simple script that do it for you:

#!/bin/bash
DISK=sdz
LBAS=$(cat /sys/block/$DISK/size)
dd if=/dev/zero of=/dev/$DISK bs=512 count=1024
dd if=/dev/zero of=/dev/$DISK bs=512 seek=$(($LBAS-1024)) count=1024

Very Important!!! Please replace sdz with the device name. I advice you to triple check the disk before executing the script. I am not responsible if you delete another disk by mistake.