Asterisk PJSIP wizard and phone provisioning

So after setting up Asterisk with a working DAHDI configuration for the PBX project, next was configuration for IP phones using PJSIP and provisioning them.

Asterisk has a built-in module called res_phoneprov which handles HTTP based phone provisioning but that didn’t work for me – I just couldn’t have it generate XML configuration for the phones that we had, i.e. Grandstream GXP1625.

The server on which I had configured PBX was multi-homed, as in it was part of multiple networks. But there was no reason to run the service on all interfaces except the VLAN on which we were going to connect the phones.

Continue reading “Asterisk PJSIP wizard and phone provisioning”


Asterisk PBX with Reliance PRI Line using Digium TE131F

So I got an opportunity to set up Asterisk PBX with a Reliance Communications E1 line. I have worked with Asterisk PBX, but without PSTN interfacing. This post is about what all stuff I have done to get a Reliance E1 line with Digium TE131F card.

Having explored a lot of other distributions like Fedora, Arch, Gentoo, Sabayon, etc. since I ventured into Linux world and learning the internals of Linux and how different components are stitched together I settled on Ubuntu. It’s my favorite these days because  everything seems to work out of the box… except when it doesn’t, then you have PPAs. 😛 For this project I have installed Ubuntu 16.04 server edition.

Continue reading “Asterisk PBX with Reliance PRI Line using Digium TE131F”

A nonsensical ride with a rude UberPool rider

So I had went to drop my vehicle for servicing and took UberPool to return back home. UberPool is quite economical compared to traveling in auto rickshaws – they quote random prices which is not justifiable according to the distance.

There was this co-rider with me who had come with some luggage from another city and apparently the driver had suggested him pooling because his distance was long; and it seems the rider had never used UberPool earlier.

The logical thought about pooling would be – drop the rider at the specified drop location and continue with next passenger. And that’s what holds in Uber’s policy as well – I did not know about this either but came to know about it when the guy called Uber customer care and started complaining to them about not dropping at the specified location.

The problem with the specified map location by the rider was – there is construction going on at that place and due to road rerouting it is not possible to go there. So the rider called up his local contact and asked where to come, the person on phone said some location which was a some 100-200 meters away from the drop location and inside some lane. The driver refused for the same. The rider got angry about this.

The driver stopped at the junction but it was creating traffic jam so he went to the other side, and stopped under the flyover where the original map location was given.

Looks like that shot his anger off the roof and he called police and said driver is refusing to drop at his location and taking him elsewhere and also said since he was not from this city the driver was harassing him. The driver explained to police (over phone) about the reality and police also asked the rider to get down at the drop location or discuss this problem with Uber customer care.

This is when he called Uber customer care and once again, he was proved wrong (because Uber can track vehicle location) and vehicle was standing exactly at drop location. Customer care rep also asked him to get down and not get into any fight.

Since lot of time was getting wasted I asked the driver to take him to the nearby location which was originally discussed by this rider’s local person. So both of them started arguing with the driver that it is his mistake and he is harassing him because he is from other city. Eventually the argument settled down after driver apologizing for no mistake of his.

End of story.

People have brains in their knees or what? You can clearly see traffic getting piled up and there is construction going on in the front, and your drop location has been reached yet you are arguing about dropping at a different location?

Also do not treat cab drivers like they are your slaves. They are doing business.


ZFS convert stripe to striped-mirror

OpenZFS LogoI’m a huge fan of ZFS because of its performance and other features like snapshots, transparent compression. In fact I had switched to FreeBSD for servers just because it had native ZFS support. But as of Ubuntu 16.04, ZFS is officially supported for non-root partitions.

Now I’m migrating a FreeBSD server to Ubuntu 16.04 with ZFS for data storage – this is happening because I need support for some special hardware which has drivers only for Linux and I do not have a spare server machine of same capacity in terms of memory/disk/processor.

My case –
Here’s the zpool layout on my existing FreeBSD server:

Each of those disks are 1TB in size and the layout here is something known as RAID 10, or striped mirroring. Striped mirroring can be extended to more than four disks but in my case, I have two pairs of disks. Each pair is mirrored and the each such mirror is striped, illustrated as in the image below:

Image taken from, their trademark/copyright holds.

The advantage of this layout is that you get read speed of four disks, and write speed of two disks and a failure tolerance of two disks (but in different mirrors) at the same time.

I have a spare 1TB disk which I can use for preparing a new server using a low-end machine for migration. I remove one of the disks from the live server so the pool there runs in a degraded state. The removed disk is used in the new server. So I create this zpool in Ubuntu:

The pool created here is a plain simple stripe. To convert this into a striped-mirror, the zpool attach command has to be used:

With this, the pool now becomes a striped mirror:

Perfect! 😀


SystemD FastCGI multiple processes

Of late, many mainstream distributions have been switching to SystemD as their init system. This includes Debian (since Debian 8) and Ubuntu (since Ubuntu 15.04). In the traditional SysV init system we used to have stuff like spawn-fcgi or custom scripts for starting a FastCGI process and having the web server connect to it over Unix or TCP sockets. Such kind of usage decreased when PHP FPM was introduced since it’s safe enough to assume that 90% (probably more) of the FastCGI deployments are just launching PHP interpreters using whatever mechanism is there (spawn-fcgi or custom scripts). PHP FPM does this for you now and it’s pretty good at it.

FastCGI is just a protocol, it can be used by any application. For custom applications which do not support starting their own FastCGI processes and listening on a socket we have to use external mechanisms. SystemD has a couple of good features which can help reduce the amount of custom work needed in terms of process monitoring, socket paths, file ownership, etc.

Continue reading “SystemD FastCGI multiple processes”