CGRateS Tutorial Series- Installation – Mongo DB Server Install – Debian 8 – Part 1

Below are the steps to prepare a stand alone mongodb server for cgrates on Debian 8 jessie

Install sudo

 apt-get install sudo 

Import key

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 

Add repository URL

echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Update and Install

 apt-get update 
 apt-get install -y mongodb-org 

Enable and Start

 systemctl enable mongod.service 
 systemctl start mongod 

Setting up CGRates User

Create a file cgrates_user.js with the following content

db = db.getSiblingDB('cgrates')
db.createUser(
 {
 user: "cgrates",
 pwd: "CGRateS.org",
 roles: [ { role: "dbAdmin", db: "cgrates" } ]
 }
)

Run the following command to create the user

mongo create_user.js

Succesful output will be as follows:


MongoDB shell version v3.4.10
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.10

Successfully added user: {Successfully added user: { "user" : "cgrates", "roles" : [ { "role" : "dbAdmin", "db" : "cgrates" } ]}

By default mongo server will only listen to localhost, modify that in /etc/mongod.conf

Quick Restart and you’re good to go!

 systemctl restart mongod 

 

Gain Settings for DJI Naza M v2

I have been building myself a quad copter , specifically a DJI F450 Flamewheel with DJI E305 propulsion system hooked to a DJI Naza M V2 with GPS. I have found the gain settings to be really tricky to play with , so this is a reference for anyone who wants to learn more about gains.

Here’s a video of a guy from Netherlands explaining the gains in detail:

 

Below are the standard gain settings for Naza M v2 from DJI

F330:

Naza M; 2212 engines; DJI 18 amp ESC. 3S Lipo, DJI 8045 Propeller:

Basic Gain:
Pitch: 140 Roll: 140 Yaw: 100 Vertical: 110
Attitude Gain:
Pitich: 140 Roll: 140
Max. Angular rate:
Both on standard (150)

F450:

Naza M; E300 Power set (2212 engines); 3S Lipo, 9450 Propeller:

Basic Gain:
Pitch: 150 Roll: 150 Yaw: 100 Vertical: 105
Attitude Gain:
Pitich: 150 Roll: 150
Max. Angular rate:
Both on standard (150)

Naza M; E305 Antriebsset; 4S Lipo, 9450 Propeller:

Basic Gain:
Pitch: 110 Roll: 110 Yaw: 70 Vertical: 100
Attitude Gain:
Pitich: 170 Roll: 170
Max. Angular rate:
Both on standard (150)

Naza M; E310 Antriebsset; 4S Lipo, 9450 Propeller:

Basic Gain:
Pitch: 95 Roll: Yaw 95: 70 Vertical: 100
Attitude Gain:
Pitich: 100 Roll: 100
Max. Angular rate:
Both on 300

F550:

Naza M; E300 Power set (2212 engines); 4S Lipo, 9450 Propeller:

Basic Gain:
Pitch: 170 Roll: 170 Yaw: 150 Vertical: 140
Attitude Gain:
Pitich: 170 Roll: 170
Max. Angular rate:
Both on standard (150)

Naza M; E310 Power set; Landing gear, Zenmuse 3D, 4S Lipo, 9450 Propeller:

Basic Gain:
Pitch: 140 Roll: 140 Yaw: 90 Vertical: 95
Attitude Gain:
Pitich: 150 Roll: 150
Max. Angular rate:
Both on 300

Naza M; E310 Power set; 4S Lipo, 9450 Propeller:

Basic Gain:
Pitch: 110 Roll: 100 Yaw: 80 Vertical: 100
Attitude Gain:
Pitich: 100 Roll: 100
Max. Angular rate:
Both on 300

Remove /home partition on CentOS 6

Centos by default creates a separate LVM with /home , which is un-necessary in certain installs , to remove it, follow the procedure

To check the current status:

[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       50G  1.2G   46G   3% /
tmpfs                 935M     0  935M   0% /dev/shm
/dev/xvda1            485M   55M  405M  12% /boot
/dev/mapper/VolGroup-lv_home
                       45G  180M   43G   1% /home

Executing the changes:

umount /home
lvm lvremove /dev/mapper/VolGroup-lv_home
lvm lvresize -l+100%FREE /dev/mapper/VolGroup-lv_root
resize2fs /dev/mapper/VolGroup-lv_root

Checking size again:


[root@localhost /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       95G  1.2G   89G   2% /
tmpfs                 935M     0  935M   0% /dev/shm
/dev/xvda1            485M   55M  405M  12% /boot

Modifying /etc/fstab to remove the mount point for /home

#
# /etc/fstab
# Created by anaconda on Thu Jul  3 11:57:44 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=bba0a5bb-7a8a-4d63-896f-c38b23422de3 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_home /home                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

Poor Man’s GSM BTS :: Nuand’s BladeRF & OpenBTS 5 Setup Instructions

!!!! THIS IS FOR EDUCATIONAL PURPOSES ONLY !!!!

These instructions are for setting up and running OpenBTS with Nuand’s BladeRF x40 Board , These are a work in progress and should be taken as is. This was possible with the help of @mambrus on #bladerf and @rwr on #bladerf.[1] and is a collection of different how-tos linked at the end of the post.

OS Used : Ubuntu 12.04 LTS Server 32 bit , The ISO can be downloaded from here

1. Download & Install Ubuntu 12.04 32 Bit , Do a minimalistic install with OpenSSH server.
2. Update git

$ sudo apt-get install software-properties-common python-software-properties
$ sudo add-apt-repository ppa:git-core/ppa (press enter to continue)
$ sudo apt-get update
$ sudo apt-get install git

Pre-Reqs Installation

Once this is setup , its time to setup the pre-requisites

Copy and Paste this , and run it – it will install the dependencies:

sudo apt-get install $(
    wget -qO - https://raw.githubusercontent.com/RangeNetworks/dev/master/build.sh | \
    grep installIfMissing | \
    grep -v "{" | \
    cut -f2 -d" ")

Another way to install the dependencies is to look for IFMissing in the above file and install them via apt-get or you can build from source.

Two of the packages would fail (libzmq3 & libzmq3-devel) – They can be installed on Ubuntu with the following commands

$ sudo add-apt-repository ppa:chris-lea/zeromq
$ sudo apt-get update
$ sudo apt-get install libzmq3-dbg libzmq3-dev 

The next step is to build uhd , that be done by compiling GNURadio from source , running the command below will do that , and is going to a take a LOT of time , depending on your computer. [ http://code.ettus.com/redmine/ettus/projects/uhd/wiki/UHD_Linux <= You can following this link as well for UHD] [bash] $ wget http://www.sbrac.org/files/build-gnuradio && chmod a+x ./build-gnuradio && ./build-gnuradio [/bash] Once that is done , you'll get either a success or a failure message , you can use the -v option to do a verbose install again to find out and fix the issue. Next step is to install some more dependencies for OpenBTS , they are the following 1. libgsm1-dev 2. asterisk-dev 3. asterisk-config On ubuntu , this can be done by [bash] $ sudo apt-get install libgsm1-dev asterisk-dev asterisk-config [/bash] You may or maynot need to update libusb as well , depending on your system , head over to www.libusb.org and download the latest copy in /usr/src and compile. copy it over to /usr/lib/x86_64-linux-gnu/libusb.so after taking a backup of the original file.

OpenBTS Installation

Once you have all the dependencies sorted out , Its time to install openBTS

1. Create a directory for OpenBTS (obts in our case )
2. Change to that directory and run the following

#!/bin/bash

git clone https://github.com/RangeNetworks/openbts.git
git clone https://github.com/RangeNetworks/smqueue.git
git clone https://github.com/RangeNetworks/subscriberRegistry.git

#From here and downwards you can copy&paste (that's why the ';' are for)
for D in *; do (
    echo $D;
    echo "=======";
    cd $D;
    git clone https://github.com/RangeNetworks/CommonLibs.git;
    git clone https://github.com/RangeNetworks/NodeManager.git);
done;
git clone https://github.com/RangeNetworks/libcoredumper.git;
git clone https://github.com/RangeNetworks/liba53.git

3. Build libcoredumper

cd libcoredumper;
./build.sh && \
   sudo dpkg -i *.deb;
cd ..

4. Build liba53

cd liba53;
make && \
   sudo make install;
cd ..;

5. In the same directory , check out YateBTS

svn checkout http://voip.null.ro/svn/yatebts/trunk yatebts 

6. The next step is to remove autoloading of the FPGA since we will be loading it permanently. To do that , open up

vim ./yatebts/mbts/TransceiverRAD1/bladeRFDevice.cpp

and add #ifdef NEVER on line 108 and #endif on line 129 – Since both lines are empty , future patches should work as well.

7. Change to YateBTS directory and run autogen.sh

$ cd opbts/yatebts
$ ./autogen.sh

8. This will generate a configure script , Now if you run the configure script immediately , it will fail while looking for YATE , so open up the configure file

$vim configure

Look for as_fn_err $? “Could not find Yate” “$LINENO” 5 and change it to as_fn_warn $? “Could not find Yate” “$LINENO” 5

9. Rerun configure

$ ./configure

10. You only need two directories from YateBTS

a) Peering

$ cd /home/openbts/obts/yatebts/mbts/Peering
$ make

b) TransceiverRAD1


$ cd /home/openbts/obts/yatebts/mbts/TransceiverRAD1
$ make

11. Copy the two binaries over to OpenBTS folder.


$ cd ..
$ cp ./yatebts/mbts/TransceiverRAD1/transceiver-bladerf openbts/apps/
$ cd openbts/apps/
$ ln -sf transceiver-bladerf transceiver

12. Build OpenBTS


$ cd /home/openbts/obts/openbts
$ ./autogen.sh
$ ./configure --with-uhd
$ make

13. Next step is to configure the SQL-lite Database , For bladeRF , a few modifications are required. They can be done as

$ vim /home/openbts/obts/openbts/apps/OpenBTS.example.sql

Look for the following and replace their values

GSM.Radio.RxGain from 47 to 5 
GSM.Radio.PowerManager.MaxAttenDB to 35
GSM.Radio.PowerManager.MinAttenDB to 35

Once that is done , proceed to the next step

14. Create OpenBTS configuration directory

$ sudo mkdir /etc/OpenBTS

15. Install DB , from OpenBTS source directory

$ sudo sqlite3 -init ./apps/OpenBTS.example.sql /etc/OpenBTS/OpenBTS.db ".quit"

16. Once that is done , you can test it by running the following command

$ sqlite3 /etc/OpenBTS/OpenBTS.db .dump

If you see a lot of output – Then the installation is successful , Proceed to the next step

17. Run OpenBTS by using the following commands

$ cd /home/openbts/obts/openbts/apps
$ sudo ./OpenBTS

If you see system ready – Your BTS is up and running and now if you do a search for networks from your phone , it should show Test PLMN or 00101 in your phone.
WP_20150116_18_20_34_Pro

WP_20150116_18_19_51_Pro
18. If you see the above , shutdown openBTS and proceed to the next step for installation of subscriber registry, sipauthserve and smqueue , both of these are required for running openBTS – Without them , the phone will not register to the test network.

19. To setup the Subscriber Registry database you must first create the file path the db will reside in. By default, this is /var/lib/asterisk/sqlite3dir . Create that directory

$ sudo mkdir -p /var/lib/asterisk/sqlite3dir

20. To build sipauthserve

$ cd subscriberRegistry
$ ./autogen.sh
$ ./configure
$ make

This will create a binary sipauthserve in /home/openbts/obts/subscriberRegistry/apps

21. The next step is to configure sipauthserve , this can be done by

$ cd /home/openbts/obts/subscriberRegistry
$ sudo sqlite3 -init subscriberRegistry.example.sql /etc/OpenBTS/sipauthserve.db ".quit"

22. The next step is to build and install SMQUEUE , SMQUEUE will complain about missing SubscriberRegistry.h – Which can be fixed by creating a symlink to subscriberRegistry directory in smqueue build path.

$ cd /home/openbts/obts/smqueue
$ ln -s /home/openbts/obts/subscriberRegistry/ SR
$ autoreconf -i
$ ./configure
$ make

23. Once this is done , SMQUEUE configuration needs to be imported.

$ cd /home/openbts/obts/smqueue
$ sudo sqlite3 -init smqueue/smqueue.example.sql /etc/OpenBTS/smqueue.db ".quit"

bladeRF Firmware Update & FPGA Loading

24. Head over to [https://github.com/Nuand/bladeRF/wiki/Upgrading-bladeRF-firmware] and update the firmware.

25. Once that is done , Head over to [http://www.nuand.com/fpga.php] to download the appropriate FPGA image for your board.

26. Load the FPGA image

$ bladeRF-cli -L <path to fpga image file>

patience , lots of it, or you may damage your board!

27. Once all of this is done , start the services one by one

$ cd /home/openbts/obts/smqueue
$ sudo ./smqueue &
$ cd /home/openbts/obts/subscriberRegistry/apps
$ sudo ./sipauthserve &
$ cd /home/openbts/obts/openbts/apps
$ sudo ./OpenBTS &

25. Start OpenBTSCLI by running

$ cd /home/openbts/obts/openbts/apps/
$ sudo ./OpenBTSCLI

28. By default , OpenBTS will not accept your registration , till you do the following

a) Enter a regex for your IMSI
b) Allow all IMSIs to be accepted by setting

config Control.LUR.OpenRegistration .*

in the openBTS cli.

THIS WILL ALLOW ALL OF THE HANDSETS REGISTERING TO YOUR BTS – INCLUDING YOUR NEIGHBOURS! DONOT USE IT PERMANENTLY !!!!

29. You should now be able to search your network on your phone , and latch onto it – Dial 600 to do an echo test on Asterisk from your phone!

30. Please ensure that you follow all local laws!

[1] https://github.com/Nuand/bladeRF/wiki/Minimalistic-build-and-run-test-for-OpenBTS-5
[2] https://wush.net/trac/rangepublic/wiki/BuildInstallRun#ConfiguringOpenBTS
[3] https://wush.net/trac/rangepublic/wiki/CommonErrors
[4] http://openbts.org/w/index.php/Main_Page
[5] https://github.com/Nuand/bladeRF/wiki/Upgrading-bladeRF-firmware

2014 In Review

Unlike last year , I am not particularly enthusiastic about 2015 , Part of this has to do with the way things are at the moment. If I were , I would have a hard time cheering people up.

Professionally, Telecom business is not expanding finally and is more focused on consolidating and cost reductions , with unexpected twists and turns that one has to navigate through.

I left my job in 2014 partly due to the extreme stress , which was driving me nuts and was hurting me both physically and mentally , and partly because I wanted to give starting and running my own shop, a try.

Personally , Its been a mixed bag of an year , part of it being amazingly awesome and part being downright depressing. Overall , I didn’t do enough , not as much as I wanted to do and wanted to grow professionally and personally , which is something I would like to address in 2015 hopefully.

Met a lot of new people in 2014 , lost a few good friends as well , overall , it was really really hard to stick to any plans in these conditions. I am hoping for a wonderful 2015 , one where I can both professionally and personally grow!

Here’s to hopefully a good 2015, maybe it will give us a break this time !

Cheers & Happy 2015!

Configure Your PTCL SmartLink SIP Account On Freeswitch

Following up on my previous post on how to configure your PTCL Smart Link SIP account on asterisk, below is the configuration I used for PTCL – Just replace USERNAME and PASSWORD with your credentials.

<gateway name="ptcl">
		<param name="username" value="USERNAME" />
		<param name="realm" value="59.103.224.34" />
		<param name="from-user" value="USERNAME" />
		<param name="from-domain" value="59.103.224.34" />
		<param name="password" value="PASSWORD" />
		<param name="extension" value="USERNAME" />
		<param name="expire-seconds" value="900" />
		<param name="register" value="true" />
		<param name="register-transport" value="udp" />
		<param name="retry-seconds" value="30"/>
		<param name="extension-in-contact" value="true" />
		<param name="caller-id-in-from" value="false" />
		<param name="enable-100rel" value="true"/>
</gateway>

You will also need to change your user agent , This can be done by adding the below parameter in sip_profiles/external.xml

<param name="user-agent-string" value="CSipSimple_hwmt1-u06-16/r2"/>