Feb 02 2010

OpenBTS : An Opensource Telephone Network

Category: AsteriskBipin Balakrishnan @ 4:42 pm

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.

Tags: , , ,


Oct 11 2008

My experience in Open Source Asterisk Platform

Category: AsteriskBipin Balakrishnan @ 11:00 pm

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.

Tags: , , , , , , , , , , , , ,


Jul 18 2008

Asterisk Applications with Ruby On Rails

Category: AsteriskBipin Balakrishnan @ 12:15 pm

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

Tags: , , ,


Apr 10 2008

Software PBX

Category: TelephonyBipin Balakrishnan @ 4:47 pm

asterisk_users.jpg

Traditionally we all are using the hardware PBX for our day to day application.That is we buy a Hardware from the vendors connect to our telephone system and use it.Lots or proprietary PBX are there in the market that we can buy and install to our Telephone connection or PRI connection.

The disadvantage with these system is that it cost a lot and it will only have limited functionality. A normal people cant afford it.

Have you ever think about a PBX that can be downloaded from the web and can use for the same application that we does with a hardware PBX or much more that a hardware does normally.Nothing to wonder, a company called Degium is providing such a software.

Degium provides an open source software called Asterisk which does the same functionality of a PBX and more like.

  • Building up IVR(interactive voice responce) application
  • VoIP calls making and handling
  • Connecting employees working from home to the office PBX over broadband connections
  • Connecting offices in various states over VoIP, Internet or a private IP network
  • Giving all employees voicemail, integrated with the Web and their E-mail
  • Building interactive voice applications, that connect to your ordering system or other inhouse applications
  • Giving access to the company PBX for business travellers, connecting over VPN from airport or hotel WLAN hotspots
  • Music-on-hold for customers waiting in queues, supporting streaming media as well as MP3 music
  • Call queues where call agents jointly handle answering incoming calls and monitor the queue
  • Text-to-speech system integration (the Festival Open Source and Cepstral Swift speech synthesis software can be integrated)
  • Call data record (CDR) generation for integration with billing systems
  • Voice recognition system integration (such as the Sphinx Open Source voice recognition software)
  • The ability to interface with normal telephone lines, ISDN basic rate and primary rate interfaces

Interesting right…..We can kick off the proprietary PBX systems and can build our own application as we needed with our Opensource PBX.

Tags: , , ,


Feb 12 2008

Zaptel configuration for Asterisk

Category: AsteriskBipin Balakrishnan @ 3:19 pm

syntax is as folows:

span=<"spannum">,<"timing">,<"LBO">,<"framing">,<"coding">

Before going any further, lets have a closer look at these options:

spannum:

This defines the number of the span (=port). This is counted across the cards. (have a look at the picture of the te4xxp cards to see where it starts counting.

E.g.:

If you have a quad e1/t1 card, and a single port e1/t1 card, you will need 5 spans.

Span 1 might be on the first card or on the second card, so there are two options:

span 1 = first port on the single port card.
span 2,3,4,5 = the ports on the quad port card.

or span 1,2,3,4 = the ports on the quad port card
span 5 = the first port on the single port card.

LBO= Line Build Out – Length of cable between Zap card and SmartJack/telco provided modem. Almost always should be set to 0 unless you have a long cable. This distance does NOT include the copper in the street to the CO/exchange.
0: 0 dB (CSU) / 0 – 133 feet (DSX-1)
1: 133 – 266 feet (DSX-1)
2: 266 – 399 feet (DSX-1)
3: 399 – 533 feet (DSX-1)
4: 533 – 655 feet (DSX-1)
5: -7.5 dB (CSU)
6: -15 dB (CSU)
7: -22.5 dB (CSU)

Framing and coding:

Lets have a look at the possible options for a T1 setup:

- Framing: how to communicate with the hardware at the other end of the line.
D4 or ESF

- Coding:another parameter of the communication with the other end of line hardware.
AMI or B8ZS

Usually when the line is ESF framing, the line coding is B8ZS and when the line is D4 SF framing, the line coding is usually AMI.

e.g.: span=1,1,0,esf,b8zs

Lets have a look at the possible options for an E1 setup:

- Framing:
CCS or CAS

- Coding:
AMI or HDB3

On an E1 card, you can optionally enable CRC checking.

e.g : span=1,1,0,CCS,HDB3,crc

Timing:

As mentioned before, every line needs to have a synching time source on one of both ends. (An asterisk PRI line can be clocked internally or can be clocked by the telco or the PBX it is connected to.)

Lets rephrase this to make this a little more clear:

Internal timing is when the timing is taken from the clock in the card.
External timing is when the timing is taken from the line on the PRI.

Timing is done PER card, so every card needs its own timing sources defined. (they can NOT be shared across cards.)

The timing parameter in the span definition in zaptel.conf determines the selection of primary, secondary, and so on sync sources. If the span you are defining should be considered a primary sync source, then give it a value of “1″.
(This means, zaptel will take the timing as received on the line connected to this port (span). This is called external clocking. if no timing was received on this line, it will fallback to internal clocking, meaning it will look at its own clock chip and generate timing,)

To define a secondary clock source, use “2″, to define a 3rd one, use 3, and so on.

span=1,1,0,esf,b8zs – This is the FIRST digital Zaptel span on the system, has PRIMARY priority to receive timing FROM the other end of the link, the cable to the SmartJack/modem is less than 133 feet in length, this span uses ESF framing and B8ZS line encoding. A fairly typical T1 span definition.

span=2,2,0,ccs,hdb3,crc4 – This is the SECOND digital Zaptel span on the system, has SECONDARY priority to receive timing FROM the other end of the link, the cable to the SmartJack/modem is less than 133 feet in length, this span uses CCS framing and HDB3 line encoding, CRC4 error checking is also enabled. This is a fairly typical second E1 span definition.

A sample configuration for the zaptel.conf file having 2 spans in the E1 card

span=1,1,0,ccs,hdb3
bchan=1-15,17-31
dchan=16
loadzone = in
defaultzone= in
span=2,1,0,ccs,hdb3
bchan=32-46,48-62
dchan=47

Tags: , , , ,


Feb 12 2008

Removing Asterisk

Category: AsteriskBipin Balakrishnan @ 3:17 pm

Stop Asterisk and unload its modules
The first thing you have to do is to stop Asterisk and unload the modules it may be using, e.g Zaptel’s.

The following lines will brutally terminate Asterisk and kill all ongoing conversation. You have to kill safe_asterisk first, otherwise it will respawn Asterisk.

killall -9 safe_asterisk
killall -9 asterisk

Then you’ll have to unload the Zaptel drivers; check which ones are loaded by issuing a:

[root@localhost]# lsmod | grep zaptel
zaptel 214820 2 wcfxo,wctdm
crc_ccitt 2113 1 zaptel

This means that the submodules wcfxo and wctdm are loaded for zaptel. We’ll have to remove them in reverse order:

modprobe -r wcfxo
modprobe -r wctdm
..repeat for all zaptel submodules….
modprobe -r zaptel

If you repeat the lsmod | grep zaptel command now, it should find nothing.

Delete Asterisk files
By running the commands below, you will delete with no possible recovery an Asterisk system. First make a backup of things you’d like to keep, lik ethe log files or the configuration files.
star Remember: once you run these commands, there’s no turning back!

rm -rf /etc/asterisk
rm -f /etc/zaptel.conf
rm -rf /var/log/asterisk
rm -rf /var/lib/asterisk
rm -rf /var/spool/asterisk
rm -rf /usr/lib/asterisk

Now your Asterisk system has been completely removed.

Tags: , ,