::BiPiN::

My Experiments with Technology!!!

468
  • Home
  • About

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

 
No 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

Asterisk on Open Solaris

Posted by admin in June 4th 2008  

As i mentioned in the previous post i installed open Solaris in my laptop and worked on it for some time.My next step was to finding out whether we can install asterisk in Solaris.When i googled out about this and got an article telling the performance of asterisk when running it on the solaris OS, which got to be better than in linux.You can read it out from here .

Downloaded asterisk from the SolarisVoIP.

The installation procedure is as follows.

$ pfexec wget http://www.solarisvoip.com/SVasterisk-rev146-x86-5.11.pkg
 $pkgadd -d SVasterisk-rev146-x86-5.11.pkg  

This will make asterisk got installed in your solaris machine.

There is a slight variation in the configuration file created in Solaris than linux.Some important paths needed are explained below.

Configuration file path: /etc/opt/asterisk/  
Call file creation path: /var/opt/spool/asterisk/outgoing/ 
Sound File path :        /var/opt/asterisk/lib/sounds/
Log messages :                /var/opt/asterisk/log/messages
Modules path : /opt/asterisk/lib/modules/ 

Starting asterisk command:

pfexec /opt/asterisk/usr/sbin/asterisk -vvvvvvgc

I have created some sample dial Plans and it got worked on.Later tried AGI with PHP it also got worked on it. Dont have much idea how much will be efficient when connected to Zap channels with Zap channel drivers.For Sip its working fine.

2 Comments
under: Asterisk
Tags: Asterisk on Open Solaris, Asterisk Solaris, Asterisk with Solaris, Open Solaris
Digg it Add to del.icio.us Stumble it add to technorati

My Experince in Open Solaris

Posted by admin in May 29th 2008  

opensolarisphoto.png

Recently we had a plan to switch our servers from linux to Solaris. Hence i have a try on Solaris which was a new experience.As in my laptop i had both windows and Linux (Ubuntu).I was thinking how to install the third one with out losing the others.On that time i heard about VMware .The name “VMware” comes from the acronym “VM“, meaning “virtual machine“, while ware comes from second part of “software“.

With VMware we can install any other operating System in Virtualization.Suppose we have linux OS in our system only after installing VM ware we can install Windows and Solaris on it.One of the major benefit is that we can easily switch from one OS to other with out any reboot.Nice one right!!!

Installing VMware in ubuntu OS is as follows.

sudo apt-get install vmware-server

After installing Vmware we can install any other os on it.In my case i installed OpenSolaris using the boot CD.

OpenSolaris is an open source project created by Sun Microsystems to build a developer community around Solaris Operating System technology. It is aimed at developers, system administrators and users who want to develop and improve operating systems.OpenSolaris is derived from the Unix System V Release 4 codebase, and has significant modifications made by Sun since it bought the rights to the codebase in 1994.

After it got finished we can log into the new OS as we does as normally with out any reboot.Solaris booting in my ubuntu OS is shown below.

sola.jpeg

We had full screen option in the VMware to work as if we are working on the solaris OS booted and loaded.The look and feel is similar to that of the same UbuntuOS. The next issue was installing the the packages.In Ubuntu we had apt-get option. Here we had similar option called pkg-get install.

But but default installation it will no be avilable hence we have to install it first.

Step 1 - Install pkg-get

# pkgadd -d http://www.blastwave.org/pkg_get.pkg

Step 2 - Install the complete wget package

We will now use pkg-get to install the complete wget package along with all its dependencies.

Simply type the following :

# /opt/csw/bin/pkg-get -i wget

Another example for installing mozilla
#/opt/csw/bin/pkg-get -i install mozilla
For searching a package like apt-cache in Ubuntu

#pfexec /opt/csw/bin/pkg-get -a | grep apache2

will search the package Apache2

Like sudo in ubuntu we have pfexec to execute the root command in solaris.

The next thing was checking the ip address of my machine when it is in solaris.The command is similar to linux but a slight variation

pfexec ifconfig -a

Will show the ip address

To get ip address via dhclinet

$ pfexec ifconfig pcn0 dhcp drop

$pfexec ifconfig pcn0 dhcp start

For those who dont like command like installation can use the package manager in graphical mode to install packages.

Also try to use full paths for running or restarting a service.For example

for starting apache use

pfexec /usr/apache2/2.2/bin/apachectl restart

This much for now will be continued in my coming posts…;)

No Comment
under: Solaris
Tags: Open Solaris, Vmware
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 (17)
    • 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

  • 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

  • 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
  • Making PHP program as Daemon
  • Asterisk with Google Talk

Recent Comments

  • 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
  • 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)
  • My experience in Open Source Asterisk Platform (1)
Box-Tube Box Modulize WordPress Theme By Dezzain Studio
©2006-2008 ::BiPiN::
Powered by WordPress 2.3.3    Valid XHTML    Valid CSS