Sunday, January 15, 2012

SIP Protocol Messages


Requests

  • INVITE Indicates that a user is being invited to join a session.
  • ACK Confirms that client has received a response to the invite message.
  • BYE Terminates a call.
  • CANCEL Cancels any Pending Searches.
  • OPTIONS Queries for Capabilities.
  • REGISTER Registers the Address listed in the header field with a SIP Server

Responses

1xx Informational Messages

  • 100 Trying: Indicates that a request has been initiated by the caller and the called party has yet not been located.
  • 180 Ringing: Indicates that the called party has been located and is being notified of the call.
  • 181 Call is being forwarded: Indicates that the called party has rerouted the call to another.
  • 182 Queued: Indicates that the called party is currently not available, and have put the call in queue.
  • 183 Session in Progress

2xx Successful Responses

  • 200 OK: Indicates that the request has been successfully processed.

3xx Redirection Responses

  • 300 Multiple Choices: Indicates that the address resolved to more than one location.
  • 301 Moved permanently: Indicates user is no longer available at this location, an alternate location should be included in the header.
  • 302 Moved Temporarily: Indicates that the user in temporarily unavailable, an alternate location should be included in the header.
  • 305 Use Proxy: This response indicates that the caller must use a proxy to contact the called party.
  • 380 Call is not successful but alternate services are available.

4xx Request Failure Responses

  • 400 Bad Request: Indicates the request sent could not be understood.
  • 401 Unauthorized Request: Indicates the request requires authorization.
  • 402 Payment Required: Indicates payment is required to complete the call.
  • 403 Forbidden: Indicates Server has received the request but will not provide the service.
  • 404 Not Found: Indicates the server was not found.
  • 405 Method Not Allowed: Indicates that the request contains a list of methods that are not allowed.
  • 406 Not acceptable: Indicates that the request can not be processed by the client.
  • 407 Proxy Authentication Required: Client must first authenticate itself with a proxy.
  • 408 Request Timeout: The server could not produce a response before a given time out.
  • 409 Conflict: Indicates a conflict with the current state of the resource.
  • 410 Gone: Resource is no longer available at the server and no forwarding address was found.
  • 411 Length Required: User refuses request without a specified length.
  • 412 Request Entity Too Large: Server refuses to process request because URI is too long.
  • 415 Unsupported Media: Indicates the format of the body is not supported by the destination endpoint.
  • 420 Bad Extension: The server could not understand the protocol extension indicated in the required header.
  • 480 Temporarily Unavailable: Indicates that the called party was contacted but was temporarily unavailable.
  • 481 Call Leg Transaction Does Not Exist: Indicates that the server was ignoring the request of bye or cancel since there is no matching Invite transaction.
  • 482 Loop Detected: (Also, Request Merged) Server received a request which has it self in the path.
  • 483 Too Many Hops: The server received a request that required more hops than allowed.
  • 484 Incomplete Address: The server received a request with an incomplete address.
  • 485 Ambiguous: Server received a request in which the called address is ambiguous.
  • 486 Busy Here: The called party was contacted but the system was not able to receive any more calls.
  • 487 Request Terminated: The calling party canceled the request before the dialog was established with a 200 OK.
  • 488 Not Acceptable Here
  • 489 Bad Event: See RFC3265
  • 491 Request Pending
  • 493 Undecipherable
  • 494 Security Agreement Required: See RFC3329

5xx Server Failure Responses

  • 500 Server Internal Error: Server encountered an unexpected error and could not process the request
  • 501 Not Implemented: Server does not support the functions required to complete the request.
  • 502 Bad Gateway: Server received an invalid request upstream.
  • 503 Service Unavailable: Server has an overload or maintenance problem.
  • 504 Gateway Timeout: Server did not receive a timely response from another server.
  • 505 Version Not Supported: Server does not support the SIP protocol used in the request.

6xx Global Failure Responses

  • 600 Busy Everywhere: Called party is busy and cannot take the call at this time.
  • 603 Decline: Called party was contacted but does not want to take part in the call.
  • 604 Does Not Exist Anywhere: Called Party does not exist anywhere in the network.
  • 606 Not Acceptable: Called party has rejected some part of the call session description as unacceptable.

Sunday, November 27, 2011

Difference between Asterisk and Freeswitch


Asterisk and FreeSWITCH are B2BUA (Back-to-back user agents). They act as a user agent for two or more ends, and use a common protocol like the Session Initiation Protocol (SIP). The B2BUA is responsible for handling all SIP signaling between the end-points, route calls, transfer calls, translate codecs between the call legs and offer value-added features to the call such as voicemail and call transfer.
In other words, they are telephony platforms designed to facilitate the creation of voice and chat driven products. FreeSWITCH in particular, can scale from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the call flow.

Isn’t FreeSWITCH a soft-switch and Asterisk a PBX? What is the difference?
Extracted from the FreeSWITCH FAQ:
"A PBX is an entity that allows a private company to have its own mini phone company providing services like voicemail, extensions and conferencing to phones. The primary focus of a PBX is for multiple phones to find each other and communicate. A soft-switch is a software application that can connect phone lines from one network to another, often routing calls from one protocol to another or to a termination point such as a PBX. FreeSWITCH has the potential to also implement a PBX but it is not mandated to. Think of it as a lower level application than a PBX. It’s possible to load several modules into FreeSWITCH to make it behave exactly like a cluster of PBX applications. This is entirely easier than trying to make a single monolithic PBX behave as a switch especially when much of the PBX functionality is permanently built into the core of the PBX application."

My first experience with Asterisk 

I installed Asterisk in my lab setup and right now it does inbound/outbound, IVR (Interactive Voice Response), conferences, voicemail, call forwarding and almost everything else you would expect from a nice VoIP (PBX) server. There are some things that some of us would like to have that are not currently available in the Asterisk software, such as dialing out from conferences and soft-based conferences. A few employees have asked me for the option to dial out from conferences but I cannot yet add this to our configuration because the feature doesn't exist in Asterisk. It is a technical limitation of Asterisk but it is available on FreeSWITCH. This is one of the reasons that FreeSWITCH would be better suited for us.
I have a fair amount of Asterisk knowledge now. I have used it for some time and I know its merits and its problems. The nice thing about Asterisk is that it's really easy to set up and configure the way you want. The bad thing about it is that it has some internal problems on its core and sometimes it gives you unexpected problems. It also lacks some of the features we need.

Asterisk issues and bugs I have found in the software

I ran into some problems when I tried to deploy Asterisk on a VPS first (Amazon EC2). When I tried to do conferencing, I needed the MeetMe application that provides conferences, and MeetMe depends on Zaptel (which is another piece of software that provides the timing that MeetMe needs). I tried to install Zaptel, but Zaptel refused to work on XEN (the virtualization software that our VPS uses). So I didn't have any other choice but to go with a dedicated server for our VoIP needs. FreeSWITCH works great on a VPS with all the conferencing features, and everything out of the box - no zaptel, ztdummy or anything that could interfere is needed.
I tried very hard to make Asterisk work with the conference features on the VPS (Amazon EC2). I also tried with other conference applications like app_conference. This doesn't require an external timing source like MeetMe does, but it lacks some features that we needed, such as sound notifications. MeetMe had this but MeetMe wasn't an option on the VPS because of its technical requirements. I also tried to get support on Asterisk and their response to my problem was that it was "irrelevant".
This was the first time I started asking myself, "Why do I need a ztdummy driver (Zaptel) in order to use the conference module? Why can't the conference module use it's own internal timing source?" I thought there was something wrong with this design. That was the first time I heard about FreeSWITCH and when I saw the light.
I also experienced DTMF problems and sound corruption with Asterisk. This happens because the Asterisk core is broken. I tried doing the same things in FreeSWITCH and everything worked great.
After all of the work that I put into making Asterisk work on our server, I keep discovering more and more problems with it. The first problem I discovered after everything was working was the DTMF problem. One day an employee asked me why his password wasn't working. I went and looked at the server and his password was there and everything looked good. Then I tried to debug it and I put a function on the dialplan that returned the digits that you send to the server and to my surprise, the server was printing bad/broken digits. So after a lot of research, I have come with the conclusion that the DTMF in Asterisk was broken.

One workaround for this problem was to use rfc2833compensate=yes in the sip configuration, in order to compensate the DTMF digits or RTP packets... this fixed it with X-Lite but the problem still happens with Zoiper. I'm sure this is the reason that passwords fail for conferences sometimes.
Another problem I had was with sound. The sound gets corrupted after a while with the Speex codec. Again I reported a bug of this
I have also experienced some deadlocks with Asterisk as reported here:bugs.digium.com/view.php
I have tried the same things with FreeSWITCH and I haven't experienced the problems. It all went very smoothly and FreeSWITCH has some features that Asterisk doesn't, such as dialing out from conferences.
I came to the point where I realized that we need a better solution. Asterisk has too many problems for our company. I decided to go with FreeSWITCH in order to have a high quality PBX.

On the way to a better VoIP solution with FreeSWITCH
The learning curve on FreeSWITCH for me wasn't that bad. However, I didn't know so it was a bit tedious for me at first. I now realize that the XML configuration is a good thing. Regular expressions in the dialplan make it succinct and the XML makes adding customized features very easy and straightforward. FreeSWITCH is a class-five soft-switch that can be molded the way you want, from a PBX to carrier-grade soft-switch to anything you can ever imagine, and it's very extensible. The design that its creator went with is excellent. It is a masterpiece and there is nothing in the open source world or in the proprietary world that comes even close to it. I think that it is a great piece of work.
One of the big advantages of FreeSWITCH is that it's core is better designed, with a lot of care in the details. The primary author of FreeSWITCH is a former developer that spent a lot of time working with the flawed Asterisk design and finally gave up and decided to build a VoIP system that would be stable, scalable and extensible. The stable part means that we'll all be able to sleep well at night.
One of the nice things about FreeSWITCH is the community. The developers themselves and the users all hang in one channel - #freeswitch (at freenode). The mailing list is also a very nice place. In both places they are very friendly and supportive, unlike the Asterisk/Digium community. They are also open-minded. At one point I asked for a feature (mod_yaml) and the creator of FreeSWITCH (Anthony Minessale) came up with this feature in less than 3 hours - without even knowing what YAML was when the feature was asked for. It was really impressive. He came up with a whole new feature that he hadn't even heard of yet, while the Asterisk devs can't even fix little bugs.

Another nice thing about FreeSWITCH is that it doesn't suffer from the "Not Invented Here" (NIH) syndrome that Asterisk suffers from. FreeSWITCH uses the Sofia SIP stack, a 100% RFC compliant SIP stack, which is very complete, robust and mature. Nokia also actively contributes in this stack along with the FS developers. They also use XML and PCRE (Perl Compatible Regular Expressions) for the dialplan, the Apache Portable Runtime (APR) and SQLite. FreeSWITCH has the ability to load scripts written in LUA, Python, Perl, PHP and XML in the dialplan as "applications” so you have a lot of flexibility and freedom in how you want to configure your VoIP system.

Please write to me at dipkumar.mehta@gmail.com for Freeswitch Consultancy across the globe.


Friday, October 21, 2011

How to install Asterisk 1.8 on Ubuntu Server 11.04


It is easy to install and use an Asterisk  on Ubuntu New Server addition 11.04 – if you do it frequently. 
I use Asterisk 1.8.3.3 on my 64 bit Ubuntu Server 11.04.
After the upgrade on a fresh install, we need three packages to build up our Asterisk. Let’s install the build-essential, libxml2-dev, and ncurses-dev packages. These package are not included by default and should be installed seperately as described below. 
apt-get install build-essential libxml2-dev ncurses-dev 
Pre-requisite : 
As these packages are not included by default, running them from the CD will generate errors.
Example : E:\ no packages found. So please # comment out the CD rom related settings rc.local file.

Asterisk_01


You can find all versions of the Asterisk at the download section. Download the latest version, and extract it!

Please right-click on the tar file on asterisk site and select copy link address
/usr/src is the most common place or directory to install this files
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.3.3.tar.gztar zxvf asterisk-1.8.3.3.tar.gz

or 
wget paste Link address
Then install the Asterisk, config, and the shamples.

cd asterisk-1.8.3.3/
./configure
make
make install
make config
make samples 
Without the above-mentioned additional packages, you will face with these error messages during the ./configure command run.
Lack of build-essential package:

configure: error: in `/root/asterisk-1.8.3.3':
configure: error: no acceptable C compiler found in $PATH 
Lack of libxml2-dev package:

checking for xml2-config... no
configure: *** XML documentation will not be available because the 'libxml2' development package is missing.
configure: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option
configure: *** or install the 'libxml2' development package. 
Lack of ncurses-dev package:

configure: error: *** termcap support not found (on modern systems, this typically means the ncurses development package is missing) 
When the installation finishes, we have a preconfigured Asterisk. To test the Asterisk with two softphones, let’s configure the sip.conf and the extensions.conf.
Here is the sip.conf file:

[general]
context = default
bindport = 5060
bindaddr = 0.0.0.0
tcpbindaddr = 0.0.0.0
tcpenable = yes 

[1001]
type = friend
callerid = User One <1001>
secret = 1001
host = dynamic
canreinvite = no
dtmfmode = rfc2833
mailbox = 1001
disallow = all
allow = ulaw
transport = udp 

[1002]
type = friend
callerid = User Two <1002>
secret = 1002
host = dynamic
canreinvite = no
dtmfmode = rfc2833
mailbox = 1002
disallow = all
allow = ulaw
transport = udp 
This config means that the Asterisk listen all IP, port 5060, and the TCP is enabled. It has two extensions defined for User One and User Two.
Here is the extensions.conf file:

[general]
static=yes
writeprotect=no 

[default]
exten => 1001,1,Answer()
exten => 1001,n,Dial(SIP/1001,20,tr)
exten => 1001,n,Hangup 

exten => 1002,1,Answer()
exten => 1002,n,Dial(SIP/1002,20,tr)
exten => 1002,n,Hangup. 
This config means that there are two accessible extensions existing.
After configuring the Asterisk, we need to start it.

/etc/init.d/asterisk start 
Asterisk_02
I use X-Lite to connect to the soft PBX. Let’s configure the X-Lite!
All data come from the sip.conf. The Account name, and the Display name are the callerid. The User ID and the Authorization name are the extension number – inside the square brackets. The Password is the sicret. The Domain is the IP address of the Asterisk server.
If all configurations are good, the X-Lite will inform you.
Asterisk_03
Let’s call from User One to User Two.
Here is the User One side:
Asterisk_04
Here is the User Two side:
Asterisk_05
Troubleshooting? We always need when we try a new thing. The firs tool is the tcpdump of course, but the asterisk have a good command line interface (Asterisk CLI) to debug the problem. To access the Asterisk CLI type

asterisk -vvvvvvr 
This screen shows a successful call from 1001 to 1002.
Asterisk_06
The Asterisk works now! Are you wondering why I configured my Asterisk to answer on TCP? Because I would like to test the Direct SIP feature of the Microsoft Communications Serverand the Lync. CU next time! ;-)


Monday, February 8, 2010

How to Configure ACD in Asterisk


ACD = Automatic Distribution of Calls is extremely important for supervisors and the company to distribute the incoming calls among the team members.

How the fundamental works

Incoming call will be segregated among the teams

Example : Sales and Support

Objective :

Customer calls up a Toll Free number and hears the IVR - asking press 1 for Sales Support and press 2 for Technical Support

Call should get queued for the Sales team if customer press 1 and agent of that particular team should ring and if customer press 2 call should get queued for the technical support team

Steps to Achieve the above mentioned scenario

1) Queuing

Queues needs to be configured in the queue.conf

Example : [Sales Queue] and [Tehnical Support Queue]

[sales queue]

member => Agent/8700

[tehnical queue]

member => Agent/8701

And then create members(agents who will receive the call) in this queue

2) Agents

[agents]

Format
agent => Number of the agent,Password,Name of the Agent
agent => 8700,1234,Dip Mehta
agent => 8701,1234,James Anderson

Create agents in the agents.conf file and make them as members in the queue

3) Dial Plan Configuration

In extensions.conf, perform the following

Create the Agents Login Code which will be used for agent to login

exten => 4455,1,AgentLogin(8700)

exten => 7000,1,Queue(sales queue)


Testing

This is how it works -

Agent logs on, e.g. using code "4455" as in the example above, hears music and waits for call.

Inbound call gets transfered to extension 7000 and agents hears beep and inbound call gets connected to agent.




Tuesday, February 2, 2010

How to record a new prompt on Asterisk

This document will help you to record a new prompt on Asterisk, which can then be used for welcome IVRS messages.

For example, if you want a custom prompt like "Welcome to XYZ Company, please dial 1 for Sales support and please 2 for customer support"

Steps :

In asterisk you first need to define a number where you will call up and record the prompt.

Also you would need a location to store that prompt

In extensions.conf please do the following

; Record voice file to /tmp directory
exten => 1111,1,Wait(2) ; Call 1111 to Record new Sound Files
exten => 1111,2,Record(/tmp/asterisk-recording:gsm) ; Press # to stop recording
exten => 1111,3,Wait(2)
exten => 1111,4,Playback(/tmp/asterisk-recording) ; Listen to your voice
exten => 1111,5,wait(2)
exten => 1111,6,Hangup

Dial the number 1111 and you will hear a beep, start recording the prompt and press # when you are finished.

Asterisk - Things to know before making buying decision

In many ways the decision-making follows what’s now a well-worn path. On the one hand, do you choose the large, stable supplier whose proprietary PBX has as many features as you could ever use and that you know will be well-supported? Or do you take a flier on the far-less expensive open source system that may not yet have as full a set of features and where the future support is much less certain?

Perception vs. Reality

No one is pretending that companies such as Avaya and Cisco feel threatened yet by the likes of Digium and Fonality, which sell Asterisk PBXes, or by SIPfoundry-basedPingtel.

Digium, the leading Asterix-based open source PBX provider, is still viewed as a “nit” in the overall scheme of the telephony and unified communications market, according to E. Brent Kelly, a senior analyst with Wainhouse Research. Though he also believes it could ultimately prove an able competitor.

For many potential users, the final decision may be one of perception. As it still is with more established open-source solutions such as Linux there’s a cultural bias against open-source on the part of IT buyers at many companies.

Bill Miller, vice president of product management and marketing at Digium, admits that’s a barrier for him. A lack of support for his company’s products is not a problem in reality, for example, but he still has to struggle with the perception that it is.

“We are in the transitional period for businesses and enterprises to change their mindsets as they experience the differences [with open source PBXes],” he said.

Open Source = Support

To that extent it’s incumbent on the open source vendors to provide solutions that will put the buyer’s mind at ease.

The downloaded Asterisk software is community-supported through email and online forums and this works for many folks, Miller said. But for mission-critical businesses, he recommends using Digium’s Asterisk Business Edition for a “fully regression tested” version of Asterisk that comes with 24/7 tech support and complete maintenance and support programs.

Large enterprises will also have to be convinced that open source PBXes, which so far have mostly been used in small and midsize businesses, will scale to the thousands of users they need the products for.

However, if credibility is a guide to the future for the open source PBXes, then the past year was a good one for the movement.

Pingtel scored a major coup in October, for example, when it announced a deal with Amazon for that company to replace a legacy PBX with Pingtel’s SIPxchange Enterprise Communications Solution. Given that telephony is such a critical element of Amazon’s business, that was seen as a major endorsement of Pingtel’s product and open source in general.

Likewise, Digium also in October struck a multi-year deal with conferencing giant Polycom Inc. for that company to integrate Asterisk telephony features into its SIP-based desktop and phone products for sale to small and midsize businesses.

Saturday, October 17, 2009

MySQL Change root Password

Setting up mysql password is one of the essential tasks. By default root user is MySQL admin account. Please note that the Linux / UNIX login root account for your operating system and MySQL root are different. They are separate and nothing to do with each other (indeed some admin removes root account and setup admin as mysql super user)

mysqladmin command to change root password

If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:

$ mysqladmin -u root password NEWPASSWORD

However, if you want to change (or update) a root password, then you need to use following command

$ mysqladmin -u root -p'oldpassword' password newpass

For example, If old password is abc, and set new password to 123456, enter:

$ mysqladmin -u root -p'abc' password '123456'

Change MySQL password for other user

To change a normal user password you need to type (let us assume you would like to change password for vivek):

$ mysqladmin -u vivek -p oldpassword password newpass

Changing MySQL root user password using MySQL sql command

This is another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update password using the following method to update or change password for user vivek:

1) Login to mysql server, type following command at shell prompt:

$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

mysql> use mysql;

3) Change password for user dip

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='dip';

4) Reload privileges:

mysql> flush privileges;
mysql> quit

This method you need to use while using PHP or Perl scripting.

Install and Configure phpMyAdmin on Ubuntu LAMP


PhpMyAdmin is a nice database management and administration tool, it is easy to install it, but some people are having problems making it work under apache, that’s because it needs configuration. I presume you already have LAMP installed and configured on your machine, if not, please read this post – Install and Configure LAMP on Ubuntu first.

Just in case you haven’t installed phpMyAdmin yet, type the following line in the Terminal:
apt-get install phpmyadmin

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf, first type the following command to open up this file:
nano /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:
Include /etc/phpmyadmin/apache.conf

Now restart Apache:
sudo /etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin, you should be able to see the phpMyAdmin landing page now!

Tuesday, October 13, 2009

New Threat to Voip Industry - SPIT

VoIP Spam Is Called SPIT


As if an inbox jam-packed with email ads for organ-enlargement and weight-loss products was not bad enough, now VoIP users can look forward to becoming a brand-new target. Slowly but surely, spammers are adding SPIT (SPam over Internet Telephony) to their bags of tricks. Warned Terrence Brewton, a Frost & Sullivan market analyst, “SPIT is an evolving threat that will come on par with the prevalence of spam, all because of the VoIP products we’re now seeing in homes and the commercial marketplace.”


More than simply an annoyance, SPIT’s real-time impact on a network “ ... creates business risks because it opens up companies to denial-of-service attacks like any other IP-based system,” said Brewton. What’s more, SPIT can consume bandwidth, thereby diminishing call quality and reducing employee productivity.

While it’s true that SPIT is still quite rare, VoIP’s growing popularity is certain to make its presence more widespread. Fortunately, there are steps that companies can take to combat SPIT.

Filtering: According to Brewton, “The best course of action for any IT manager who is trying to protect his VoIP system is to buy filtering technology and keep up with patch management.” But while VoIP providers can help filter out obvious SPIT before it traverses a network, there is always a risk of false positives — legitimate traffic or large-scale message transmissions that are accidentally flagged as SPIT and prevented from reaching employees.

Firewalls: A VoIP firewall is an application driven by a security policy that defines whether to allow or deny certain calls. Administrators set policies through GUIs similar to those found in traditional data firewalls. A first line of defense against numerous threats, this technology detects and blocks VoIP DoS (denial-of-service) attacks, SIP attacks, toll fraud, virus infections and SPIT.

VoIP SEAL: NEC Corp.’s VoIP SEAL is a new tool that targets calls originating from spam-generating software and ill-intentioned humans. SPIT is detected and blocked based on communication patterns observed during the call. If a spam-related call comes in, VoIP SEAL will prevent the phone from ringing.

Voice Recognition: Microsoft has developed V-Priorities, a system for automatically screening phone calls. The technology works by analyzing characteristics of a caller's voice and word usage to figure out how urgent a call is and whether the caller is a friend, a family member, a colleague or a stranger.

Although the aforementioned security options are effective SPIT countermeasures, they also present drawbacks. “Any time you try to run any type of packet through any kind of filter, it’s going to slow down network processes. That’s because VoIP is a very sensitive piece of technology,” said Brewton. Such latency issues can lead to reduced quality of service and customer frustration.

Nor is there a panacea for SPIT. Even the brightest and best-prepared IT managers can be a step behind hackers. Said Brewton, “Everything changes at the speed of light on the Internet. Spammers are changing their tactics constantly because they’re trying to make money like anybody else. So by the time you’ve figured out what they’re doing, they’ve gone on to the next attack. That’s the one thing people really have to remember about security; we’re always fighting yesterday’s attack.”

Further complicating matters is the fact that the savings accrued through a VoIP network can be somewhat offset by having to invest in the appropriate security technologies. In the end, said Brewton, companies need to weigh what they stand to gain — and possibly lose to SPIT — by deploying a VoIP network. “With any technology,” said Brewton, “you really need to take pause and ask yourself, ‘Do I really need to deploy this? Is this going to be cost-effective? What is going to be my total cost of ownership for purchasing such a new technology?’”


www.astnext.com is dealing in Anti SPIT solutions to tackle this

Monday, September 7, 2009

Train yourself on Asterisk

Thanks everyone for your overwhelming support

I would like to take this blog to a next level, where i will
post interesting engineering applications on asterisk

So Need to fund for the project, henceforth i am starting
to train the people so that they also be a part of my
blog

Please email me at dipkumar.mehta@gmail.com and
book your slots

15 $ per hour for Asterisk Training

Ask your doubts or whatever little queries you have.

Friday, September 4, 2009

ISDN Alarms indications in zaptel/Dahdi

The TE200 series user manual contains only a description of LEDs states.

These alarmsstates are visible in zttool/dahditool or in astersick CLI (zap show status)

You have three different general alarm states:

Red alarm
---
Your T1/E1 port will go into red alarm when it maintain
synchronization with the remote switch. A red alarm
typically indicates either aphysical wiring problem,
loss of connectivity, or a framing and/or line-coding
mismatch with the remote switch. When your T1/E1 port
loses sync, it will transmit a yellow alarm to the remote
switch to indicatethat it's having a problem receiving
signal from the remore switch.(The easy way to remember
this is that the R in red stands for "right here" and "receive".
.. indicating that we're having a problem right here
receiving the signal from the remote switch.)

Yellow alarm or RAI (Remote Alarm Indication)
---
Your T1/E1 port will go into yellow alarm when it receives a
signal from the remote switch that the port on that remote
switch is in red alarm.This essentially means that the remote
switch is not able to maintain sync with you, or is not receiving
your transmission. (The easy way to remember this is that t
he Y in yellow stands for "yonder"... indicating that the
remote switch (over yonder) isn't able to see what you're
sending.)

Blue alarm or AIS (Alarm Indication Signal)
---
Your T1/E1 port will go into blue alarm when it receives all
unframed 1s on all timeslots from the remote switch. This is
a special signal to indicate that the remote switch is
having problems with it's upstream connection.


Please contact me at
dipkumar.mehta@gmail.com if you need any help regarding isdn troubleshooting issues

Sunday, August 30, 2009

G.729 and G.723 Codec installation on Asterisk

Installation and Configuration of G.729 and G.723 codecs on asterisk
  1. Download the codec binary file from http://asterisk.hosting.lv/bin/codec_g729-ast14-gcc4-glibc-pentium4.so
  2. Copy it to the /usr/lib/asterisk/modules folder.
  3. Restart the Asterisk: /etc/init.d/asterisk restart

Estimating the Number of G.729 Channels Required

If you choose to purchase the G.729 license from Digium you will need to compute the number of G.729 channels required by your configuration. You can estimate the required value by using the following information:

  • a call between two SIP extensions usually requires two G.729 channels, unless the pass-thru mode is used (http://voip-info.org/wiki/view/Asterisk+G.729+pass-thru), in which case it doesn’t require any G.729 channel.
  • a call between a SIP extension and a Zaptel/DAHDI extension/trunk requires one G.729 channel.
  • a call to Voice Mail or another Asterisk service where IVR messages must be played requires one G.729 channel.

SIP Trunking - IP Based authentication and Password based authentication

SIP trunking is the method of sending calls to ITSP service provider using sip protocol.

Indepth details refer RFC 3261

There are two types of authentications

1. IP based authentication
2.Username and Password based authentication


For IP Based Authentication

You need to do the following changes in the sip.conf


[siptrunk]
type=friend
fromuser=X.X.X.X ( your asterisk server ip ) which will send traffic to the service provider
host=X.X.X.X ( service provider ip )
canreinvite=no
qualify=no
dtmfmode=RFC2833
context=intenal
disallow=all
allow=g729
allow=ulaw
allow=alaw
port=5060


Then you need to edit extensions.conf
[intenal]
exten => _9X.,1,Dial(SIP/${EXTEN}@siptrunk)


For Username and password based authentication

[siptrunk]
type=friend
username=
fromuser=X.X.X.X
host=X.X.X.X
canreinvite=no
secret=
qualify=no
dtmfmode=RFC2833
context=intenal
disallow=all
allow=g729
allow=ulaw
allow=alaw
port=5060

define username and password to it





Wednesday, July 8, 2009

How to read DTMF and store in the database in Asterisk

Aim :

To Read a variable in the form for DTMF tones as pressed by the caller.

For example if you would like your users to call up the system and record there inputs in the database and then make use of Asterisk to perform what ever tasks with those recorded inputs.

Syntax :

Read(variable[,filename][,maxdigits][,option][,attempts][,timeout])

Reads a #-terminated string o
f digits a certain number of times from the user in to the given variable.
  • variable: variable where the user's response will be stored.
  • filename: file to play before reading digits.
  • maxdigits: maximum acceptable number of digits. Stops reading after maxdigits have been entered (without requiring the user press the '#' key). Defaults to 0 - no limit - wait for the user press the '#' key. Any value below 0 means the same. Max accepted value is 255.
  • option: may be 'skip' to return immediately if the line is not up, or 'noanswer' to read digits even if the line is not up.
  • attempts: if greater than 1, that many attempts will be made in the event no data is entered.
  • timeout: Timeout in seconds. If greater than 0, that value will override the default timeout.

Read should disconnect if the function fails or errors out.

[edit]

Example

; The Following Example uses Read and Say digits to read 3 digits from user, saying each one as user types.

Asterisk 1.2:
exten => s,1,Gotoif($[ "${LEN(${extensao})}" < "3"]?3:100)
exten => s,n,NoOp(Executing - ${extensao} - )
exten => s,n,Read(digito||1)
exten => s,n,SayDigits(${digito})
exten => s,n,Set(extensao=${extensao}${digito})
exten => s,n,GoTo(s,1)
exten => s,100,GoTo(from-pstn,s,1)
exten => h,1,hangup()

Asterisk 1.4, 1.6:
exten => s,1(start),Gotoif($[ "${LEN(${extensao})}" < "3"]?collect:pstn)
exten => s,n,NoOp(Executing - ${extensao} - )
exten => s,n(collect),Read(digito,,1)
exten => s,n,SayDigits(${digito})
exten => s,n,Set(extensao=${extensao}${digito})
exten => s,n,GoTo(start)
exten => s,n(pstn),GoTo(from-pstn,s,1)
exten => h,1,hangup()


[edit]

Notes

Pipe characters ( | ) have been changed to commas in Asterisk 1.6.
In Asterisk 1.4, either pipes OR commas will work. Using commas will ease future upgrades.

'#' is the End-Of-Input Key. It is NOT possible to accept '#' with Read()

Warning:
In Asterisk 1.4: the "filename" field does not accept concatenation (file1&file2&file...).

Tuesday, July 7, 2009

Configuring a queue

The following queue works as following:

star all calls are monitored, i.e. saved to disk
star if after 60 seconds on the queue the call is unanswered, the call is routed to voicemail
star there are two levels of agents: agents 302 and 303 will answer the queue (level 1); only if none of them is available the call is routed to agent 301 (level 2). If nobody is available, the queue keeps trying until timeout is reached.

Extensions.conf

[q-my-sample]
; ...queue description.....
exten =>
s,1,SetVar(MONITOR_FILENAME=/var/spool/asterisk/queuecalls/QSAMPLE-${
UNIQUEID})
exten => s,2,Queue(q-sample|n|||)
exten => s,3,Playback(voicemail-invitation)
exten => s,4,VoiceMail,s2001

Queues.conf

[q-sample]
music = default
announce = q-sample-announce
strategy = roundrobin
timeout = 60
retry = 5
maxlen = 0
announce-frequency = 0
announce-holdtime = no
monitor-format = wav
monitor-join = yes
queue-youarenext = silence
queue-thankyou = q-sample-thankyou
member=>Agent/302,0
member=>Agent/303,0
member=>Agent/301,1

Understanding queue logic in Asterisk

When a call enters the queue application, there are many possible scenarios, that are controlled by the queue's own timeout and the ringing timeout.

If a timeout is specified on the queue command itself, that is the maximum queue wait length (we call this queue timeout). It is the maximum time that a caller can wait on hold on the queue. If that time is expired, then the caller is moved on to the next step in the dialplan. If no timeout is specified, we assume it to be the default value, i.e. 300 seconds (5 minutes).

There is then another timeout specified in the queue definition itself, that is the ringing timeout. This is the queue "loop time", i.e. the timeout over which events in the queue are rotated. If the queue finds a free member, it tries to ring it for the given period of time. If it finds no free members, it retries finding a new member when this time period expires. In any case, the global queue timeout is triggered only when this timer expires, so if this timeout is very long, your queue timeouts may be longer than expected. If a member is busy or unavailable (e.g. an extension that is not working) it is skipped as soon as the condition is detected and the next available agent is rung.

If the option "n" is passed to the queue command, there are no retries, i.e. when the retry period expires, the queue is terminated no matter what.

It is possible to add a wait time after an extension is ringed unsuccessfully and the next one is ringed; this parameter id the retry parameter in the queue definition.

When the ringing timeout expires, all queue events are processed, not only the global queue timeout; if an announce is set and the time from the last announce has elapsed, then the announce is played. While the announce is being played, no new agent is being called; this might be a minor problem if your queue-thankyou message is very short, but if it is quite long and quite frequent, you may find an undue slowdown on your agents being searched.

As a summary, we can say that:
star Your ringing timeout should ideally be quite short (10-15 seconds)
star Announce frequencies and the overall queue timeout should be comparatively much longer than the ringing timeout, and are triggered on a schedule driven by the ringing timeout
star The time taken to play announces is added between each ringing timeout cycle, so if it is very long, you may find that your agents sit idle while callers listen to the announcement.