::BiPiN::

My Experiments with Technology!!!

468
  • Home
  • About

Load Balancing Asterisk Servers

Posted by admin in April 17th 2009  

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….:)

No Comment
under: Asterisk
Tags: Asterisk Tuning, Load Balancing Asterisk Servers, Optimizing Asterisk servers.
Digg it Add to del.icio.us Stumble it add to technorati

BarCamp Kerala-2009

Posted by admin in April 13th 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.

2 Comments
under: Asterisk
Digg it Add to del.icio.us Stumble it add to technorati

Shell script for checking a sytem alive or not

Posted by admin in January 7th 2009  

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…:)

2 Comments
under: Shell Scripts
Tags: Checking alive system shell script., Shell script for checking a sytem alive or not
Digg it Add to del.icio.us Stumble it add to technorati

Asterisk noise issue

Posted by admin in January 1st 2009  

A few weeks back  i faced a strange issue when installed asterisk in a server which uses ss7 line signalling.The issue was with the sound quality when making calls.Spoiled my two days with the issue and finally it got sloved. Here i am sharing my experience, hope it might be helpful for you guys.

Normally the noise issue can occur due to the following reason.

  • Hardware issue ( With Server / The card)
  • Codec Problem.
  • IRQ Sharing.
  • CPU load issue.

The Hardware issue

Please make sure that your server configuration is matching with what recommended by the digium. Please follow the link to choose your server.

http://www.voip-info.org/wiki/index.php?page=Asterisk+hardware+recommendations

If the server configuration is ok you can now double check the card, some time the card can also cause noice issue.Replace a the card and try again. Some card may have echo cancellation facility make sure that it is also enabled in the asterisk part also.

Codec Problem

A codec is a device or computer program capable of encoding and/or decoding a digital data stream or signal .Asterisk support different kinds of codes like gsm,wav,ulaw,alaw etc.The codec mostly used in gsm network is the gsm.Normally the MSC will convert any format to gsm format before transmitting to the mobile.If there you get a disturbed sound while making calls with a gsm format file try with wav format which is having a better sound quality than gsm.Please note to change the sound frequency that should be understood by asterisk (Asterisk normally understand sound in 8KHz ).

You can use sox for the sound conversion.

Example below converts a wav file to a file  with frequency 8KHz supported by asterisk.

sox file.wav -r 8000 -c 1 -s -w file1.wav resample -ql

IRQ Sharing

An interrupt is a method by which a piece of hardware communicates with the processor. It’s called an interrupt, because the device (such as a network card) interrupts the computer to carry out a function such as I received information, do something with it, or i’m ready with this task, give me a new one.

If  E1 card is sharing the IRQ with I/O devices the sound quality issue can occur  .We can check the interrupt status by using the command.

cat /proc/interrupts

If the any other resources is sharing the IRQ with the E1 card we can try options like putting up the card in another slot or can go to BIOS and can disable the interrupt sharing devices.

CPU load issue

The CUP load issue can be occured by many reason like MYSQL load, the  AGI programs load etc.We can see which process is consuming more memory-CPU by using the top command and can try to optimise it. Asterisk communicates with the AGI program over stdin and stdout. The arguments are passed directly to the AGI program at execution time.As AGI use  stdin and stdout reading and writing it will definitely affect the performance of the system.Better to implement almost all things in the dial plan itself. if your are 100% sure it can’t be done  with dial plan then move to AGI script.

No Comment
under: Asterisk
Tags: Asterisk noise issue, Asterisk sound issue, Asterisk sound quality
Digg it Add to del.icio.us Stumble it add to technorati

AsteriskNOW -Asterisk for normal users.

Posted by admin in December 4th 2008  

asterisknow-logo-sm.gif

Worried about installing the packages of asterisk??? .Fed up with the dependencies asking while installing the asterisk packages???? .AsteriskNOW is a solution for those who is not at all good in linux or dont have time for searching the dependencies.AsteriskNOW is an open source Software Appliance; a customized Linux distribution that includes Asterisk (the leading open source telephony engine and tool kit), the AsteriskGUI™, and all other software needed for an Asterisk system. AsteriskNOW is easy to install, and offers flexibility, functionality and features not available in advanced, high-cost proprietary business systems.

Any one who know to install linux OS can use asteriskNOW like installing a normal linux OS. AsteriskNOW can be called as Asterisk+Zaptel+Libpri installed in a CentOS.The user need or have to worry about installing these package separately and the dependency issue caused during the installation.

Due to some trademark issue the Digium renamed the Zaptel project as DAHDI.The configuration is almost same as like Zaptel.

Details should be available at http://www.asterisk.org/zaptel-to-dahdi

Configuration Files

/etc/zaptel.conf Becomes /etc/dahdi/system.conf
/etc/asterisk/zapata.conf Becomes /etc/asterisk/chan_dahdi.conf

Channel Name

Chennel “Zap” replaces as “DAHDI”

eg: For Zap : Zap/g2/984XXXXXXX

eg: For DAHDI : DAHDI/g2/984XXXXXXX

The CDR will be configured automatically, if you want cdr-mysql, you need to unstall mysql addon.You can search with it with ‘yum search cdr-addon’ and for installing can use ‘yum install cdr-addon’.

Asterisk can be started by using the command ‘amportal start’ .

We can also use ‘amportal stop’ or ‘amportal restart’ if asterisk is running already.

No Comment
under: Asterisk
Tags: AsreiskNOW, DAHDI
Digg it Add to del.icio.us Stumble it add to technorati

My experience in Open Source Asterisk Platform

Posted by admin in October 11th 2008  

200px-asterisk_logosvg.png
The story begins an year ago.

I was doing my Fifth Semester MCA at SNGIST College, Cochin,India. There was a main project to be done as a part of the course during this semester.  We had just finished our mini project (which happens just before the main project) the previous semester.  As the mini project didnt go the way I anticipated, I was breaking my head for the subject of this main project.

So many questions came to my mind, like the platform, learning the technology to be used, how to make it successful, etc, as this was  important in deciding a career.  Moreover there was the pressure as i thought it is the final semester project which decides our future career.

At this point of time, I got a call from a friend of mine, who told me about an opening in Telephony domain in Torque Technology Solution (Now named as MObME) at Technopark, TVM,India. He was working as a web developer   in that company.  This struck me with the idea of doing a Telephony project.  My thought went this way, if I happen go get a chance to do my project work in this company along with the job, I could very well venture into a career in Telephony domain. Moreover I have done my degree in Electronics and had some experince in telephony domain, earned by doing  an academic project in EBAPX during the final semester. I decided to apply for that job.

Later I was interviewed and they found me fit for that position.  More over, they agreed that I may do my project work there. Thus, on April 2007, I became an employee of Torque.

Until that time, i haven’t heard anybody  doing a project in this domain in the academic project , So there were lots of questions in my mind when I started; whether it would be accepted by the college, what is the future with this technology, will I be able to make a career out of it,etc.

But there were my colleagues in Torque for help. They were really passionate about this technology even though they didnt work on it a lot. They were my inspiration.  I started learning it with the support of Mr Sanil and Mr Kenny jecob who were the co-founders of the company.They taught me how to dig in to a technology and what are the tips for it. I managed to do my academic main project on asterisk in a short period of time which gave me lot of confidence and energy to learn and try more.

I started my experiments with dial Plans, followed by AGI.  During that time Hutchison Kerala, India came up with a project for developing a customer care application called 55555 IVR.  I was given this assignment and the application was intended to enable the subscribers hear various offers available to them by calling a toll free number 55555.  This project was successfully completed  with in a short time.We used PRI connectivity provided by the service Provider to implement this.As it was simple branching, I used only dialplan.Moreover  i was not having  deep understanding of AGI at that time.

Along with that assignment, I also worked for developing a web application for making calls to the gsm network for hutchison Kerala,India with the support of Mr Sanil.  Meanwhile Hutchison was taken over by Vodafone in India. My next assignment was to make the normal 55555 to a best offer IVR.The best Offer IVR announces the best Offer to the Customers depending on the validity and talktime available as well as the static offers. Now it has changed to three layers , the first layer consists of the dynamic offers depending on the previous recharge, the second layer consists of the dynamic offers depending on validity and talktime and third layer consists of various static offers. This project was completed successfully and now vodafone Kerala is using the IVR application as well as the outbound call application developed in Asterisk Platform.  We uses both ss7 and PRI connectivity for implenting this.
I have also done other projects on making on VoIP calls, Call Conference,Making Software as well as Hard ware PBX using the Asterisk platform.

More coming in the next posts.

2 Comments
under: Asterisk
Tags: 55555, 55555 IVR, Asterisk, Best offer IVR, Intelligent IVR, IVR, Mobme, PBX, PRI, SNGIST, ss7, Torque, Vodafone Kerala, voip
Digg it Add to del.icio.us Stumble it add to technorati

Cuil Search Engine

Posted by admin in September 26th 2008  

cuil_logo.png

Cuil(”cool“, according to the creators) is a new search Engine managed and developed largely by former employees of Google: Anna Patterson, Russell Power and Louis Monier, who has since quit the company.

Cuil is a search engine that organizes web pages by content and displays relatively long entries along with thumbnail pictures for many results. It claims to have a larger index than any other search engine, with about 120 billion web pages ie Cuil searches more pages on the Web than anyone else—three times as many as Google and ten times as many as Microsoft.Also displays relatively long entries along with thumbnail pictures for many results.It went live on July 28, 2008.

Cuil is an old Irish word for knowledge. For knowledge, ask Cuil.But does it have the muscle to beat Google?.Lets wait and see.

For more to know Click Here

 
1 Comment
under: web
Tags: Cuil, Cuil Search Engine
Digg it Add to del.icio.us Stumble it add to technorati

Using Memcached with PHP

Posted by admin in August 21st 2008  

Memcache module provides handy procedural and object oriented interface to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications by caching the frequently accessed data.By default, memcached uses the port 11211.

Danga Interactive developed memcached to enhance the speed of LiveJournal.com , a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of webservers and a bunch of database servers. memcached dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization, and faster access to the databases.

The system is used by several very large, well-known sites including YouTube, LiveJournal, Slashdot, Wikipedia, SourceForge, ShowClix, GameFAQs, Facebook, Digg, Twitter, Fotolog, BoardGameGeek, NYTimes.com, deviantART, Jamendo, Kayak and in our Mobshare too.

Installing and Configuring Memcache

sudo apt-get install memcached
sudo apt-get install php5-memcache

Configuration Files

edit sudo vim /etc/php5/apache2/conf.d/memcache.ini or

sudo vim /etc/php5/cli/conf.d/memcache.ini //for cli apps

; uncomment the next line to enable the module
extension=memcache.so

[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0

Edit sudo vim /etc/memcached.conf to change the default configuration settings

Restart apache webserver

starting memcached

sudo /etc/init.d/memcached start

To see storing session on memcache on the terminal use

sudo memcached -vv

Eg 1: Using memcache in PHP

Testing Program whether it properly got installed and working fine

<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
var_dump($get_result);
?>

Outputs this as result

Server's version: 1.2.1<br/>
Store data in the cache (data will expire in 10 seconds)<br/>
Data from the cache:<br/>
object(stdClass)#3 (2) {
  ["str_attr"]=>
  string(4) "test"
  ["int_attr"]=>
  int(123)
}

Example 2: Using in database access

<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
mysql_pconnect("localhost","root","");
mysql_select_db("bestofferIVR");
//Write your time consuming query here
$key = md5("SELECT * FROM callerinfo where cnumber='9941426932'");
$get_result = $memcache->get($key);
if ($get_result) {
print_r($get_result);
echo "If condition Working";
}
else {
 // Run the query and transform the result data into your final dataset form
 $qurey="SELECT * FROM callerinfo where cnumber='9941426932';";
 $result = mysql_query($qurey);
 $row = mysql_fetch_array($result);
 print_r($row);
 $memcache->set($key, $row, TRUE, 86400); // Store the result of the query for a day
 echo "Else condition Working";
}
?>

On the First Run the output will be as below, ie directly fetcing from the DB

Array
(
    [0] => 5
    [id] => 5
    [1] => 9941426932
    [cnumber] => 9941426932
    [2] => 2008-03-20 08:28:57
    [time] => 2008-03-20 08:28:57
    [3] => mal12
    [scheme] => mal12
)
Else condition Working

From the second run onwards the result will be as below ie using the memcache not DB

Array
(
    [0] => 5
    [id] => 5
    [1] => 9941426932
    [cnumber] => 9946426932
    [2] => 2008-03-20 08:28:57
    [time] => 2008-03-20 08:28:57
    [3] => mal12
    [scheme] => mal12
)
If condition Working
2 Comments
under: PHP
Tags: Linux, Memcache, Memcache configuration, Memcache with PHP, Memcached server Installing, PHP
Digg it Add to del.icio.us Stumble it add to technorati

mtop - MySQL top

Posted by admin in July 26th 2008  

mtop or MySQL top command shows the MySQL commands consuming the greatest time.It is a command similar as top which provides a dynamic real-time view of a running system. Top can display system summary information as well as a list of tasks currently being managed by the Linux kernel.Difference is that mtop show only the MySQL tasks.

Normally, run as a console program this will allow you to see slow or badly optimized queries as they will stay on the screen for a while. However, if you are hunting for short lived queries, running in the manualrefresh mode with a short refresh time will allow you to catch short lived queries as well.
Installing mtop

sudo apt-get install mtop
No Comment
under: Linux
Tags: mtop, mtop - MySQL top, mysql top
Digg it Add to del.icio.us Stumble it add to technorati

PHP command line agrument

Posted by admin in July 24th 2008  

php.gif

We can pass command line argument to a PHP script as in any other programming language when we run it in the cli mode.For example make script called test.php in your editor.Copy paste content as follows.

<?php
echo $argv[0];
echo $argv[1];
echo $argv[2];
?>

Run the program as follows with command line argument as follows.

bipin@bipin-laptop:~/php$ php  test.php 10 22

Here the command line arguments are 10 and 22.The PHP script will take the argument as an array argv[] with the first element in the array (agrv[0]) as the program name and the arguments passed being held after that.

No Comment
under: PHP
Tags: Command line argument PHP, Passing command line agrument in PHP, PHP command line agrument
Digg it Add to del.icio.us Stumble it add to technorati
« Older Entries

Search

Visitors

My Clicks

  • www.flickr.com
    This is a Flickr badge showing public photos and videos from Bipz. Make your own badge here.

Tags

  • AndLinux- Asterisk Asterisk and googletalk Asterisk cmd MYSQL Asterisk with Google Talk Audacity mp3 export Background Process with PHP Call to undefined function mysql_connect() php Changing default ssh port Connecting asterisk with googletalk Install anything in Ubuntu Linux Linux running in Windows MYSQL nmap nusoap Open Solaris Open source PBX Passing argument to asterisk PBX PHP PHP mysql database connection Port forwarding PRI PRI testing PRI Troubleshooting Removing Asterisk rsync Sharing ubuntu Printer with Windows Shell script for ftp download Shell script ftp download Software PBX timezone in Ubuntu Troubleshooting PRI Ubuntu Ubuntu Networking Configuration Uninstalling Asterisk Web Service Web service in php Zapata Configuration Zapata Configuration for PRI zaptel.conf zaptel configuration zaptel configuration asterisk ztool

Categories

    • Asterisk
    • Linux
    • Micellanious
    • PHP
    • Shell Scripts
    • Solaris
    • Telephony
    • Ubuntu tips and Tricks
    • web

Recent Comments

  • Sohbet in Converting WAV file to GSM file
  • admin in BarCamp Kerala-2009
  • admin in Shell script for checking a sytem a…
  • Binny V A in Shell script for checking a sytem a…
  • Saurooon in BarCamp Kerala-2009
  • Teft in Making PHP program as Daemon
  • Anish K.S in Securing Web folder with htaccess
  • jsgoecke in My experience in Open Source Asteri…
  • jsgoecke in Asterisk Applications with Ruby On …
  • miner in Call to undefined function mysql_co…

Recent Entries

  • Load Balancing Asterisk Servers
  • BarCamp Kerala-2009
  • Shell script for checking a sytem alive or not
  • Asterisk noise issue
  • AsteriskNOW -Asterisk for normal users.
  • My experience in Open Source Asterisk Platform
  • Cuil Search Engine
  • Using Memcached with PHP
  • mtop - MySQL top
  • PHP command line agrument
  • Asterisk Applications with Ruby On Rails
  • Securing Web folder with htaccess
  • Editing boot loader of linux

Recent Comments

  • Sohbet in Converting WAV file to GSM file
  • admin in BarCamp Kerala-2009
  • admin in Shell script for checking a sytem a…
  • Binny V A in Shell script for checking a sytem a…
  • Saurooon in BarCamp Kerala-2009
  • Teft in Making PHP program as Daemon
  • Anish K.S in Securing Web folder with htaccess
  • jsgoecke in My experience in Open Source Asteri…
  • jsgoecke in Asterisk Applications with Ruby On …
  • miner in Call to undefined function mysql_co…

Most Comments

  • Making PHP program as Daemon (12)
  • Shell script for ftp download (8)
  • Securing Web folder with htaccess (4)
  • Asterisk Applications with Ruby On Rails (3)
  • AndLinux- Linux running in Windows (2)
  • Access Linux Partitions from Windows (2)
  • Asterisk on Open Solaris (2)
  • Using Memcached with PHP (2)
  • BarCamp Kerala-2009 (2)
  • My experience in Open Source Asterisk Platform (2)
  • Shell script for checking a sytem alive or not (2)
  • Gastman-A graphical manager interface for Asterisk (1)
Box-Tube Box Modulize WordPress Theme By Dezzain Studio
©2006-2009 ::BiPiN::
Powered by WordPress 2.7.1    Valid XHTML    Valid CSS