February 2nd, 2010

OpenBTS : An Opensource Telephone Network

Telecom industry is one of the rapid growing industry all over the world. The entrance of open-source team into the telcom industry  made a revolutionized change  in the industry. Asterisk was a typical example for it which was a featured PBX for home users, enterprises, VoIP service providers and telecoms in such a low cost that anyone even imagined.Asterisk is  both an Open Source Community and a commercial product from Digium.

Now again another open source coming which  allows standard GSM-compatible mobile phones to make telephone calls without using existing telecommunication providers’ networks.ie we can build up our own network just like vodafone,airtel or any.The project was started by Harvind Samra and David A. Burgess and named it as OpenBTS.. OpenBTS is notable for being the first free software implementation of the industry-standard GSM protocol stack.Thanks to them for making it possible.:)

A normal GSM network working is as follows.The end point of the system will be BTS (Base Transceiver Station) which send radio frequency singal to and from mobile devices or a modem.The BTScomes under BSC(Base station Controller) with makes the communication between there radio signals with  MSC/VLR.The MSC/VLR is responsible to authenticate the user against the database (HLR – Home Location Register, AuC -Authentication Center), call setup and call routing.A typical GSM network diagram is shown below.

Screenshot-1

The OpenBTS  replaces the entire setup with USRP(Universal Software Radio Peripheral), and a computer as hardware.USRP  to receive and transmit the GSM signaling(GNURadio is the driver software for this),OpenBTS package play the role of MSC/VLR and Asterisk software PBX will be used to connect calls.The below diagram shows a typical openBTS network.

Screenshot

Potential applications include:

  • rural/village telephony and text messaging
  • cellular coverage in remote areas (e.g. ships, oil rigs)
  • law enforcement and security operations
  • rapidly deployable emergency communications
  • network emulation and handset testing.

To know more click here.

December 4th, 2009

Using ORACLE and PHP in Ubuntu

oracle-php

Last week i got a chance to try ORACLE API, as i was a fresher in oracle at that time i was having little idea how to use it.After googling a while i got the way to use it.The steps i followed are written below in future hope this will find helpful for someone .
For setting up in local machine we need to install oracle Oracle Express Edition first. Please note my machine was , Ubuntu 9.04 and this worked for me.
Installing Oracle Express Edition
First you need to add this line to your /etc/apt/sources.lst

deb http://oss.oracle.com/debian unstable main non-free

Run

sudo wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add -
sudo apt-get update
sudo apt-get install oracle-xe

Then run

sudo /etc/init.d/oracle-xe configure

PHP-Oracle Binding
Now install PHP-oracle binding, will get it from here

Convert the rpm packages into debian packge using alien program if its not installed in your machine please install it using

sudo apt-get install alien

Run the commend in the downloaded packege folder

sudo alien oracle*.rpm

You’ll need the ‘pecl’ command, which is available in php-pear, php5-dev

sudo apt-get install php-pear php5-dev
sudo pecl install oci8

Enter 1 and check the oracle client lib path will be like this.

instantclient,/usr/lib/oracle/11.2/client/lib

Hit enter again and wait for a while.After completion add “extension=oci8.so” in your php.ini( both apache and cli) .Restart apache2 and check phpinfo();Okey our machine is ready to make calls to oracle binding functions and remote APIs.

The rest you can try out from here

November 21st, 2009

mtr – A network diagnostic tool

bitw1

mtr(My Trace Route) is a nice network diagnostic tool combines the functionality of the ‘traceroute’ and ‘ping’ programs and can see even the packet  in the network. It comes along with default installtion if ubuntu. To know more type man mtr or follow here . Typical example if usage is below.
Syntax::

 mtr <IP> -n

Below shows the trace to an IP with mtr tool

Screenshot

October 27th, 2009

Dell inspiron 14 Sound issue in Linux :Solution

laptop-inspiron-14-right-black-alt-314

Recently i bought DELL inspiron 14 and made it as dual boot with Windows Vista and Ubuntu 9.04 and faced a strange issue. I can hear sound Vista in headphone as well as speakers. But in case of ubuntu i can hear sound in headphone only and no speaker sound and the strange thing is that when i first boot windows and then boot ubuntu both the mic and speakers will work properly . But when i first boot ubuntu i can hear sound from the headphone only .After some googlesearch and forum posts atlast i sloved the issue.Didnt got the exact issue yet but got the solution :) .

The log files of both working and non working sound in the system seemed to be the same :( . At last tried an experiment by upgrading the ALSA driver and this time it got worked. Now i can hear sound in mic as well as in speakers…:).Anyone facing the same issue can give a try on this fix.

cat /proc/asound/version

will give the ALSA version details, mine was Version 1.0.18 and i upgraded to Version 1.0.21

Upgradation details is avilable here ::  Click

October 2nd, 2009

YAML parser kit — PHP5 bindings

YAML(tm) (rhymes with ‘camel’) is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages such as PHP, Perl and Python. YAML is optimized for data serialization,formatted dumping, configuration files, log files, Internet messaging and filtering. This specification describes the YAML information model and serialization format. PHP library packege php5-sync here parses YAML strings and converts them to PHP arrays. It can also converts PHP arrays to YAML strings.

Installing PHP binding of yaml

sudo apt-get install php5-sysc

Now you are ready to use YAML.

It’s tempting to think of YAML as being similar to XML, but in reality it’s not. Unlike XML, YAML doesn’t use elements and attributes to mark up data; rather, indentation is used to denote nested relationships, and punctuation elements like dashes (-) and colons (:) are used to mark lists and hashes of data items. To illustrate, consider the following simple YAML document, which sets up a hash containing five key-value pairs:
example of yaml file.

name : John Doe
tel  : 123-4567
fax  : 987-6543
email:
- john@domain.com
- jdoe@domain.com

Using yaml in php

Save the above example as sample.yaml

<?php
// get YAML data
$yaml = file_get_contents('sample.yaml');

// convert to PHP data structure and print
$data = syck_load($yaml);
print_r($data);
?>

will print the yaml in array format in the program

The reverse process will be like this.

<?php
// define PHP array
$data = array (
    'droids' =
array('r2d2', 'c3po'),
'heroes' =>
array(
'one' => array('luke', 'leia'),
'two' => array('han', 'chewbacca'))
);

// convert to YAML and print
$yaml = syck_dump($data);
echo $yaml;
?>
September 12th, 2009

SOX : The audio manipulation tool

Sox(Sound eXchange, the Swiss Army knife of audio manipulation) is a strong audio manipulation too in linux. SoX reads and writes audio files in most popular formats and can optionally apply effects to them; it can combine multiple input sources, synthesise audio, and, on many systems, act as a general purpose audio player or a multi-track audio recorder. So it can be told as audio player as well as converter.Till some days before i was searching a linux tool for playing gsm files eventhough i were using sox for sound conversion i didnt noticed that it can play sound files allmost in all format for that we just need to install corresponding codecs .

To install sox

$ sudo apt-get install sox

sox supported formats are

AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb au avi avr caf cdda cdr cvs cvsd dat dvms f4 f8 fap ffmpeg flac fssd gsm hcom htk ima ircam la lpc lpc10 lu m4a mat mat4 mat5 maud mp2 mp3 mp4 mpg nist ogg paf prc pvf raw s1 s2 s3 s4 sb sd2 sds sf sl smp snd sndfile sndr sndt sou sox sph sw txw u1 u2 u3 u4 ub ul uw vms voc vorbis vox w64 wav wavpcm wmv wv wve xa xi PLAYLIST FORMATS: m3u pls AUDIO DEVICE DRIVERS: alsa ao oss ossdsp

to get support of all this formats install

$ apt-get install libsox-fmt-all

We can play specified file format using the play command which come along with sox.

Eg:

sox

August 23rd, 2009

Play youtube on chrome : Linux

Chorme

Few days back i installed the debian version of chrome in my laptop seems to be very fast than any other browser.Fased an issue like unable to play youtube videos on the browser got a message like

“Hello, you either have JavaScript turned off or an old version of Macromedia’s Flash Player. Get the latest Flash player.”

Solution :

The chrome is not idetifying the  the path of flash player or the flash player is not installed. If not installed please install it first and if it is installed already enter into the default path of chorme installation ie /opt/google/chrome
find the location of flash module

sudo find / -name  libflashplayer.so

Give a softlink to the chrome folder .ie if you are in the chrome folder it will be like

sudo ln -s /usr/lib/adobe-flashplugin/libflashplayer.so .

Start the bowser with –enable-plugins to turn on the plugin.

Enjoy youtubing…..:)

April 17th, 2009

Load Balancing Asterisk Servers

high-server-load-wordpress.jpg

Some of  common question among the asterisk users  are.

  • What is the minimum hardware to setup asterisk ?
  • How many simultaneous call can asterisk machine can handle?
  • How many E1s can be plugged to a single machine?
  • Which is the best server for call making?
  • How an asterisk machine can be tuned?

Lets start to Discuss from one by one.

Minimum Hardware to setup Asterisk

The answer is simple.All we need is a normal PC installed with any of the Linux flavour in it and a lan card  if we are trying to make SIP calls only.Not a single extra hard ware required.

How to make asterisk sip calls, i have mentioned in my previous posts.

Simultaneous call can asterisk machine can handle / Max E1s

Asterisk 1.2 start to run into problems around 220 concurrent SIP calls. Asterisk 1.4 scales much better and can handle nearly double the call setups/second as well as total concurrent traffic with a hard ware of dual core processor with 4GB RAM

Digium  claims asterisk can  handle up to 240 calls simultaneous in both SIP/ Zap channels.I have experience of setting of server for outdialing application which can make 240 simultaneous calls at a time, ie with 2 quad span card connected to 8 PRI lines.

Hardware configiration is :

Server : IBM System x3400

Card : Digium TE420P

RAM : 4GB

Processor : Dual-Core Intel Xeon Processor

Best server for call making

I have tried IBM System x3400, HP Proliant 110 G4 ,  IBM System x3200 for our IVR and outdialing application which handles minimum of 120 calls at a time and its running smooth without any issues.

Tuning asterisk Machine

The best practice to make your asterisk sever to get it maximum performance are

Try to implement almost every logic in dailplan itself.

Dial Plans are just like shell script, we can implement almost all our logic with it.Go forAGI if and only if we are 100% sure that i cant be done with dail plan only.The communication between the AGI scripts and Asterisk was via standard input and standard output writing and reading cause a large memory and CPU usage.

Turn off Log files.

Asterisk uses a too many log files while running.Logs files are good when used for debugging but once we got a stable asterisk running you can turn it off or make log rotate to empty log file once in a week.This will make huge difference in the load in the machine.

Can tun off the logging by editing /etc/asterisk/asterisk.conf also.

Tune mysql to its best

If we are using MySQL as our DB in the AGI scripts tuning will give us better performance. It can be done  indexing in tables,increasing concurrent connection parameter, threading parameter in the my.cnf file

Use FastAGI

Implements the Asterisk Gateway Interface (AGI) over TCP sockets. This can help alleviate CPU load on your telephony server by relocating resource hungry scripts to another networked server. In order to instruct Asterisk to attempt a network connection, you must supply the hostname or IP address of the server where your FastAGI service is hosted and preface it with agi://:

Those having similar experience  can share their questions and experiences here….:)

April 13th, 2009

BarCamp Kerala-2009

bck5green250.png
BarCamp Kerala is an ad-hoc gathering rooted in the desire to share and learn in an open & friendly environment. It is an intense yet cool, event with discussions, demos, and strong interactions. The 5th edition of BarCamp Kerala (BCK5), is scheduled to be on May 3rd, 2009, Sunday at TechnoPark, Thiruvananthapuram.

January 7th, 2009

Shell script for checking a sytem alive or not

It is necessary in certain cases we need to check whether the system  or server is alive and if we want some alert like email or sms to inform you that the system is down.We can do it by a simple shell script .All we need is to install a package call fping

fping  is a program like ping which uses the Internet Control Message Protocol (ICMP) echo request to determine if a target host is responding.  fping differs from ping in that you can specify any number of targets on the command  line,  or  specify a file containing the lists of targets to ping. Instead of sending to one target until it  times out or replies, fping will send out a ping packet and move on to the next target in a round-robin fashion.
installing command

sudo apt-get install fping

Script:

#!/bin/sh
status=`fping 192.168.1.22 | cut -d ' ' -f 3`
if [ $status != "alive" ]
then
echo 'system is down' //Here use your alert as you like email, sms, voice alert etc
fi

Will check the system with IP 192.168.1.22 alive or not.Put it as a cron job and schedule the time interval to automatically check system status and get the alert…:)