::BiPiN::

My Experiments with Technology!!!

468
  • Home
  • About

Asterisk noice issue

Posted by admin in January 1st 2009  

A few weeks back  i faced a strange issue when installed asterisk in a server which use ss7 line signalling.The issue was with the sound quality when we makes 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 noice issue can occur due to the following reason.

  • The 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 impelemts almost all things in the dial plan itself if your are 100% sure it can’t be dont with it then only use an AGI script.

No Comment
under: Asterisk
Tags: Asterisk noice 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.

1 Comment
under: Asterisk
Tags: 55555, 55555 IVR, Asterisk, Best offer IVR, Intelligent IVR, IVR, Mobme, PBX, PRI, SNGIST, ss7, 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

Asterisk Applications with Ruby On Rails

Posted by admin in July 18th 2008  

rails.jpg

Recently while surfing in google i found that we can develop nice web+telephony applications by the combination of Asterisk and Ruby on Rails.All we required is knowledge in Asterisk and any Framework architecture.I am not much familiar in ruby still managed to develop my first app with it.

The system is built using the following components:
Asterisk – the open source PBX which is used to interface to VOIP/PSTN provider over SIP to place real telephone calls
Ruby on Rails – the super-productive web application framework built in the Ruby programming language
MySQL – database is used to store the records associated with the application data model. All database access is handles by Ruby on Rails.
RAGI – Ruby Asterisk Gateway Interface, an API for building Asterisk telephony applications in Ruby (and Ruby on Rails).

It is assumed that the you are already familiar with:

Asterisk
How to install
How to setup
Basics of what AGI is
Ruby on Rails
How to install
Rails app structure (controllers, views, models, etc)
MySQL
How to install
Basic SQL operations and queries

First Create a Web App with Ruby On Rails

mkdir    ragi_testapp
cd  ragi_testapp
rails tutorial

Create a database called ‘ragidb’

CREATE TABLE `deliveries` (
 `id` int(11) NOT NULL auto_increment,
 `user_id` int(11) NOT NULL default '0',
 `tracking_number` varchar(64) NOT NULL default '',
 `delivery_status` varchar(255) default NULL,
 `updated_on` datetime default NULL,
 `created_on` datetime default NULL,
 PRIMARY KEY (`id`)
 );
CREATE TABLE `users` (
 `id` int(11) NOT NULL auto_increment,
 `phone_number` varchar(10) NOT NULL default '',
 `updated_on` datetime default NULL,
 `created_on` datetime default NULL,
 PRIMARY KEY (`id`) );

Insert some values to the user table.

Database setup for rails

vim ragi_testapp/tutorial/config/database.yml
development:
 adapter: mysql
 database: ragidb
 socket: /var/run/mysqld/mysqld.sock
 timeout: 5000
 username: root
 password:

Enter into the tutorial directory

cd ragi_testapp/tutorial/
 ruby script/generate model User
 ruby script/generate model Delivery
 ruby script/generate controller User

Start Webbrick Server

ruby script/server

Enter into ‘controller’ directory of project

Edit user_controller.rb

class UserController < ApplicationController
 #scaffold :user
 def index
 @users = User.find(:all)
 respond_to do |format|
 format.html # index.html.erb
    end
 end
 end

Create file “index.html.erb” in veiw/user folder of the project

<h1>Listing Users</h1>
<table>
 <tr>
 <th>Phone Number</th>
 <th>Updated date</th>
 <% for user in @users %>
 <tr>
 <td><%=h user.phone_number %></td>
 <td><%=h user.updated_on %></td>
 </tr>
 <% end %>
 </tr>
 </table>

Run http://localhost:3000/user/ in the browser we can see the rails app running fetching the values in the user table.

Now the Asterisk part.

Install RAGI. This is easy, because RAGI is packaged as a “gem”. Just type the following from our command prompt:

gem install ragi

Include the configuration below in the “environment.rb” in the config folder in the project.

#The following code tells Rails to start a Ragi server as a separate thread.
Dependencies.mechanism = :require
# Simple server that spawns a new thread for the server
class SimpleThreadServer < WEBrick::SimpleServer
     def SimpleThreadServer.start(&block)
     Thread.new do block.call
    end
  end
end
require 'ragi/call_server'
RAGI::CallServer.new(:ServerType => SimpleThreadServer)

In this step, we’ll tell Asterisk where are RAGI server is so that the appropriate calls can be routed into our new application.

Now edit extension.conf of asterisk add

[ragi]
 exten => 9999,1,Set(RAGI_SERVER="localhost:4573")
 exten => 9999,2,NoOp(${RAGI_SERVER})
 exten => 9999,3,Answer()
 exten => 9999,4,AGI(agi://${RAGI_SERVER}/tutorial/dialup)
 exten => 9999,5,Hangup

When we call 9999 the call will be routed to RAGI server which can be a local system or a remote system.

Create a directory called “handlers” in your Rails app directory at the same level in your directory structure as controllers, models and views. This is where you will put the class that implements.

Create a new file called “ tutorial_handler.rb” and open that file to edit.

require 'ragi/call_handler'
class TutorialHandler < RAGI::CallHandler
 def dialup
 say_digits('12345')
 say_digits(User.count.to_s)
  end
 end

This is basically your “hello world” call handler. The class is “TutorialHandler” and is an implementation of the RAGI “CallHandler” class. The method “dialup” is automatically called when a phone call is routed by Asterisk through RAGI to this handler.Configure a sip phone and make call to 99999 and can see Ruby application answering the call.

And lots we can play :)

2 Comments
under: Asterisk
Tags: Asterisk, Asterisk Applications with Ruby On Rails, Asterisk ruby on Rails, RAGI
Digg it Add to del.icio.us Stumble it add to technorati

Securing Web folder with htaccess

Posted by admin in July 10th 2008  

seo.JPG

Htaccess is a password protection scheme used by Apache Web servers.The web server will ask an authentication to enter if we set a password for it.Here the steps explains how to set an authentication for the web folder.

  1. Create a file called .htaccess in your web folder which you want to protect.
  2. Open the file .htaccess in your favorite editor.
  3. Paste the lines below.
  4. AuthUserFile /var/www/.htpasswd
    AuthGroupFile /dev/null
    AuthName "Protected files"
    AuthType Basic
    require user bipin
  5. Change the path of .htpasswd in AuthUserFile where you are going to place the .htpasswd file.
  6. Change AuthName to from “Protected files” to any name you would like.
  7. Change require user to any user name you would like to give (This will be the authentication user name it will ask).
  8. issue command htpasswd -c <htpasswd path> <username> for password setting . For me it is htpasswd -c /var/www/.htpasswd bipin
  9. Edit httpd.conf file or the web configuration file of apache.It should be like this.
<Directory /var/www/>
   Options Indexes FollowSymLinks MultiViews
  AllowOverride AuthConfig
 #AllowOverride none
  Order allow,deny
  allow from all
</Directory>

Uncomment AllowOverride AuthConfig if it got commented.

Now onwards it will ask an authentication to enter into it.

1 Comment
under: Linux
Digg it Add to del.icio.us Stumble it add to technorati

Editing boot loader of linux

Posted by admin in June 30th 2008  

349711051_12e8f41f59.jpg

By the installation of Linux on a Windows installed machine the default loading OS becomes the Linux. If the user want to change the default one we have to edit the boot loader file of linux OS.

The name and disk location of the GRUB configuration file varies from system to system; for example, in Ubuntu, Debian GNU/Linux and openSUSE the file is stored in /boot/grub/menu.lst while Fedora and Gentoo Linux uses /boot/grub/grub.conf. Fedora also provides a symbolic link from /etc/grub.conf to /boot/grub/grub.conf for FHS compatibility reasons and other distros can establish symbolic links to the three locations.

No Comment
under: Linux
Tags: Editing boot loader, Editing grub, Linux, Ubuntu
Digg it Add to del.icio.us Stumble it add to technorati
« Older Entries

Search

Feeds

feeds
get latest updates on news and subscribes to our feeds
feeds

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 (19)
    • Telephony (3)
  • Linux (14)
    • Ubuntu tips and Tricks (6)
    • Shell Scripts (1)
  • PHP (7)
  • web (2)
  • Micellanious (2)
  • Solaris (1)

Links

  • Kenney
  • Sajith
  • Sanil
  • Shahid
  • Vishnu

Archives

  • January 2009 (1)
  • December 2008 (1)
  • October 2008 (1)
  • September 2008 (1)
  • August 2008 (1)
  • July 2008 (4)
  • June 2008 (2)
  • May 2008 (4)
  • April 2008 (7)
  • March 2008 (3)
  • February 2008 (20)

Pages

  • About

Meta

  • Login
  • Valid XHTML
  • Valid CSS

Recent Entries

  • Asterisk noice 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
  • Asterisk on Open Solaris
  • My Experince in Open Solaris
  • Monitoring a daemon

Recent Comments

  • Abhishek in Cuil Search Engine
  • deepthi in Adding favicon in your site
  • admin in Making PHP program as Daemon
  • frankvw in Making PHP program as Daemon
  • Kenney in My experience in Open Source Asteri…
  • admin in Using Memcached with PHP
  • iamatechie in Using Memcached with PHP
  • DicMicheMen in Securing Web folder with htaccess
  • ldaves in Making PHP program as Daemon
  • admin in Making PHP program as Daemon

Most Comments

  • Making PHP program as Daemon (11)
  • Shell script for ftp download (4)
  • AndLinux- Linux running in Windows (2)
  • Access Linux Partitions from Windows (2)
  • Asterisk on Open Solaris (2)
  • Asterisk Applications with Ruby On Rails (2)
  • Using Memcached with PHP (2)
  • Gastman-A graphical manager interface for Asterisk (1)
  • Securing Web folder with htaccess (1)
  • Adding favicon in your site (1)
  • My experience in Open Source Asterisk Platform (1)
  • Cuil Search Engine (1)
Box-Tube Box Modulize WordPress Theme By Dezzain Studio
©2006-2009 ::BiPiN::
Powered by WordPress 2.3.3    Valid XHTML    Valid CSS