Friday, October 28, 2011

Troubleshooting VOIP calls using wireshark.

Troubleshooting bad quality calls with Wireshark is a great way to narrow down where the source of a problem is. In this post I would like to present the basic means of using wireshark to locate the source of a problem.

In this example we are going to be looking at an issue where we seem to be having problems with outgoing audio and everyone is complaining that our call sound choppy. The incoming audio seems to be just fine. Lets take a look at the route that are call takes. when leaving the network.

The first thing we want to do is to determine if the call is leaving our network without issues, so we need to get a capture as close to the wan as we can. In this example we would want to get a capture between the PBX and the Router since the PBX is directly connected to the router. This capture will show us the state of the inbound audio before it touches the PBX and show us the state of the outbound audio as it is leaving the PBX. It is important to think about the streams this way because knowing what the audio has traversed will allow us to determine where the source of the problem is.

Now, if we listened to this audio from our capture and our outbound audio sounds good then we would know that the problem resides on the WAN side of the network, and we would want to have who ever works on the WAN to check things like T1 errors or QOS policy...

If our issue is heard on the capture then we need to look at the other side.

So we know that the issue is somewhere inside our network, what we need to do at this point is to move the capture around to different places on our network. If we move the capture to the other side, between the PBX and the Switch and re run our capture we can then determine if the problem still exists.

In this capture lets pretend that we still hear the outgoing quality issues, we know that the PBX has not introduced the problem and it is occurring somewhere on our network before getting to the PBX. So lets move the capture again, this time between the Network switch and the phone.

At this point if we are still hearing the problem we know that the switch, the PBX and our WAN are all ok, it seems as if there is a problem between the phone and the switch. Now that we know where the problem resides it will make it a lot easier for us to troubleshoot the problem.

Wednesday, October 26, 2011

Troubleshooting Voicemail to email on an Allworx System

This post will focus on the use of Voicemail to email without the use of a smart host on an Allworx System, however the contents should be applicable for any system. If you require that the email be sent only internally on the local network, then the Allworx system should be upgraded to 7.3 or above and the email pop client should be used instead of a smart-host.

There no configuration on the Allworx that needs to be done for Voice Mail to Email functionality to work other than setting up the message Alias. By default the Allworx will send email out of it’s gateway. The email will then be routed through the Internet to the destination server.

This is typically where you will run into problems. Since the Allworx does not have a registered DNS name, any mail being received by the destination server will be discarded. You can check this by doing the following.



*** can't find Non-existent domain

So you can see that the domain our Allworx is sending out does not exist as a real domain. This is exactly what an Exchange server will do before allowing email to be sent to it. In order for the exchange server to receive this, one of two things will need to happen.

The first option is to add the Wan IP Address of the Allworx into a white list on their server. When the email is received from the Allworx the Exchange server will see that the IP Address is valid and allow the email to come in even though the DNS does not exist. This is probably the simplest solution, however it is really not the best solution. If you have a hosted email server it is common that the company hosting it could refuse to white-list an IP address.

The second option is to create a DNS entry for the allworx. If the you already have a domain and you are able to manage the DNS for this domain then you can create an A record to point to the Allworx WAN IP address. For instance if I owned I could create a new A record for and point it to the Allworx WAN IP address. You would then need to change the hostname of the allworx under the configuration tab to be Now when you do an nslookup you will get a valid DNS lookup.

Server: ← This is the DNS Server that is handling the Look-up.

Address: ← this should match the Allworx WAN IP

If email is still not working after verifying this then I would suggest that you start a packet capture from the WAN port of the Allworx and leave a VM on an extension that has VM to Email. Give the Allworx about 15 seconds before stopping the capture to make sure that the email has been sent.

Open the Wire-shark capture and filter by SMTP. You should be able to see the email trying to be sent. Typically on the last row of the SMTP transaction you will find the packet with an error being sent back from the destination server.

Friday, October 21, 2011

Redirect all traffic to HTTPS in Yii Framework

There is a lot of tutorials on how to redirect traffic through https for parts of your site, but what about if you want all traffic to be redirected through HTTPS?  This task was easy on apache, but when I moved to IIS 7 I just couldnt find an easy way to do it on the server.  So, a little javascripting and we are on our way.

In your Views/templates open the Main.php file and add this script to the top:

<script type="text/javascript">
    function RedirNonHttps() {
        if (location.href.indexOf("https://") == -1) {
            location.href = location.href.replace("http://", "https://");
Then on your BODY Tag, Change it like this:

< body onload="RedirNonHttps();" >
There you go, Now all traffic will be redirected to use SSL!

Wednesday, October 5, 2011

Installing Asterisk 10 from source on Ubuntu 11.04 Server

If you are wanting to test out the latest version of asterisk I have compiled a tutorial here to try and help you out.

I am now sitting in-front of a nice clean install of Ubuntu 11.04 Server.   I have updated and upgraded my repo's and I am ready to get started with installing Asterisk.  If you need to know how to update apt-get there is good documentation here.

First thing to do is to gather the required tools needed to build our asterisk system. Since we will be compiling Asterisk from scratch we will need the gcc compiler and necessary libs to compile. The following should be all required libs for Asterisk, I am not using pri or any analog technology, but I have included the libs just in-case you are.
sudo apt-get install build-essential libmyodbc libncurses5 libncurses5-dev  linux-headers-`uname -r` libssl-dev libnewt-dev zlib1g zlib1g-dev unixodbc unixodbc-dev libtool libxml2-dev libsqlite3-dev sqlite3
Next we will download our source files. First start out by getting the link for your download from  Then we will want to change directories to /usr/src/ and use wget to download our source files. and then decompress the source files using tar.
cd /usr/src
sudo wget
sudo tar -zxvf asterisk-10.0.0-beta1.tar.gz
Now we should have everything we need to begin installing!  Go ahead and change to a sudo shell and start configuring...
sudo -s
cd asterisk-10.0.0-beta1
make menuselect 
make install
You should now have a working version of Asterisk 10.0.0 Beta 1

Creating an External IVR for Allworx with database support.

Recently I had an idea of using Asterisk to host an external IVR for our Allworx system. Mainly I want to be able to extend the functionality of our current system and add the ability to do database look-ups from the phone system. Here is an example of the setup:

I will be installing asterisk on top of a fresh install of Ubuntu Server 11.04. First thing to do is to update and upgrade your box and then install the dependencies that Asterisk requires:

sudo apt-get update && apt-get upgrade -y
sudo apt-get install build-essential libtool libncurses5-dev libssl-dev libssl-dev libxml2-dev

Now everything is ready to compile Asterisk. Let’s get the sources from Asterisk website. At this moment the latest stable version is

cd /usr/src/
sudo wget

Now we will uncompress and compile and install Asterisk
tar -xzvf asterisk-
cd asterisk-
sudo make
sudo make install

If you haven’t hit any errors, you must have a working barebone Asterisk install on your Ubuntu server. Optionally we can install samples and config files to get quickly started:
sudo make samples
sudo make config
Now you can start your Asterisk server by typing:

sudo /etc/init.d/asterisk start

and login into Asterisk CLI to check if everything is working fine:

asterisk -rv
Ok, Now that we have a working version of asterisk, we need to get a TTS (Text to Speach Engine)  I am going to be using cepstral voice, which can be found here and you can hear the voices here. Make sure you select the telephony voices as the output will need to be in the right format. I have chosen Alison and installed it using the following: (Note I am using 64bit OS, you may have to use a different link below)
cd /usr/src/sudo wget
sudo tar -xzvf Cepstral_Allison-8kHz_x86-64-linux_5.1.0.tar.gz
cd Cepstral_Allison-8kHz_x86-64-linux_5.1.0
sudo sh
Now, add the following line to /etc/
 sudo nano /etc/
and add /opt/swift/lib
and run ldconfig as root:
sudo ldconfig
If you purchase a license for the voice you can follow the instructions to register here.

You can test your tts by enetering the following, and copy the output file to a computer to play back:
swift "Hello World" -o outputfile.wav
You will also need to get the extension for asterisk that allows you to access Swift from here.
wget -xzvf app_swift-2.0.1-ast1.8.tar.gz cd app_swift-2.0.1-ast1.8makemake install/etc/init.d/asterisk restart
We will also want to install out database, apache2 and phpmyadmin:

apt-get install mysql-server apache2 php5 phpmyadmin

More coming soon, check back often!