Tuesday, March 22, 2016

VoIP using ZoiPer and Asterisk

ZoiPer and Asterisk 



After playing around with different softphones for use with Asterisk in the lab I have stumbled across what I believe to be the best softphone yet! ZoiPer is cross platform (platform independent) and for lab purposes I can download a free copy.

I can't say enough about how easy it is to get ZoiPer up and running on your system compared to any other softphone I have tried on Linux. It is a super clean install, intuitive and simple.

Asterisk has been around for a long time and the ease of installation is just amazingly simple for my lab purposes.

For the lab i'm going to pull down asterisk-1.8 form the asterisk download site and load it on my CentOS VM. My CentOS build is:

[root@localhost asterisk]# uname -a
Linux localhost.localdomain 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

INSTALL ASTERISK:

Step 1:
$ sudo su
[sudo] password for junspace:

Make sure we have C Compiler installed:

Step 2:
[root@localhost junspace]# yum install gcc
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirror.rackspace.com
 * extras: cosmos.illinois.edu
 * updates: mirrors.gigenet.com
Package gcc-4.4.7-16.el6.x86_64 already installed and latest version
Nothing to do

Step 3:
[root@localhost home]# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz

--2016-03-22 06:29:24--  http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
Resolving downloads.asterisk.org... 76.164.171.238, 2001:470:e0d4::ee
Connecting to downloads.asterisk.org|76.164.171.238|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29637478 (28M) [application/x-gzip]
Saving to: “asterisk-1.8-current.tar.gz”

100%[====================================================================================================================================================================>] 29,637,478  4.12M/s   in 7.8s    

2016-03-22 06:29:32 (3.64 MB/s) - “asterisk-1.8-current.tar.gz” saved [29637478/29637478]

Step 4:
[root@localhost home]# file asterisk-1.8-current.tar.gz 
asterisk-1.8-current.tar.gz: gzip compressed data, from Unix, last modified: Wed Apr  8 12:01:26 2015

[root@localhost home]# tar zxvf asterisk-1.8-current.tar.gz
asterisk-1.8.32.3/
asterisk-1.8.32.3/Makefile.moddir_rules
asterisk-1.8.32.3/missing
asterisk-1.8.32.3/CREDITS
...

Step 5:
[root@localhost home]# cd asterisk-1.8.32.3/

Step 6:
[root@localhost asterisk-1.8.32.3]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
...
configure: Menuselect build configuration successfully completed

               .$$$$$$$$$$$$$$$=..      
            .$7$7..          .7$$7:.    
          .$$:.                 ,$7.7   
        .$7.     7$$$$           .$$77  
     ..$$.       $$$$$            .$$$7 
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
 .777.   .$$$$$$77$$$77$$$$$7.      $$$,
 $$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7 
$$$       .7$$$$$$$$$$$$$$$$      :$$$. 
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.  
$$$        $$$   7$$$7  .$$$    .$$$.   
$$$$             $$$$7         .$$$.    
7$$$7            7$$$$        7$$$      
 $$$$$                        $$$       
  $$$$7.                       $$  (TM)     
   $$$$$$$.           .7$$$$$$  $$      
     $$$$$$$$$$$$7$$$$$$$$$.$$$$$$      
       $$$$$$$$$$$$$$$$.                

configure: Package configured for: 
configure: OS type  : linux-gnu
configure: Host CPU : x86_64
configure: build-cpu:vendor:os: x86_64 : unknown : linux-gnu :
configure: host-cpu:vendor:os: x86_64 : unknown : linux-gnu :

Step 7:
[root@localhost asterisk-1.8.32.3]# make && make install && make samples CC="cc" CXX="" LD="" AR="" RANLIB="" CFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" menuselect make[1]: Entering directory `/home/asterisk-1.8.32.3/menuselect' gcc -g -D_GNU_SOURCE -Wall -c -o menuselect.o menuselect.c gcc -g -D_GNU_SOURCE -Wall -c -o strcompat.o strcompat.c gcc -g -D_GNU_SOURCE -Wall -c -o menuselect_stub.o menuselect_stub.cCREATE SIP USERS/LINES:
...
Config file phoneprov/polycom.xml is unchanged Config file phoneprov/snom-mac.xml is unchanged [root@localhost asterisk-1.8.32.3]#

Step 8:
[root@localhost yum.repos.d]# cd /etc/asterisk/
[root@localhost asterisk]# 
Step 9:
[root@localhost asterisk]# mv sip.conf orig.sip.conf
[root@localhost asterisk]# mv extensions.conf orig.extensions.conf
Step 10:
[root@localhost asterisk]# vi sip.conf
[general]
port=5060
bindaddr=192.168.2.252
[51000]
type=friend
host=dynamic
secret=51000
[51001]
type=friend
host=dynamic
secret=51001
[51002]
type=friend
host=dynamic
secret=51002
Step 11:
[root@localhost asterisk]# vi extensions.conf
[general]
static=yes
wrtiteprotect=no
priorityjumping=no
autofallthrough=yes
clearglobalvars=no

[default]
exten => 51000,1,Dial(SIP/51000,10)
exten => 51001,1,Dial(SIP/51001,10)
exten => 51002,1,Dial(SIP/51002,10)
RUN ASTERISK:
[root@localhost asterisk]# asterisk -vvvvc Privilege escalation protection disabled! See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details. Asterisk 1.8.32.3, Copyright (C) 1999 - 2013 Digium, Inc. and others. Created by Mark Spencer Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= == Parsing '/etc/asterisk/extconfig.conf': == Found == Parsing '/etc/asterisk/logger.conf': == Found
...
Asterisk Ready. == Parsing '/etc/asterisk/cli.conf': == Found *CLI>  
*CLI> sip show peers Name/username Host Dyn Forcerport ACL Port Status 51000/51000 192.168.2.50 D N 55929 Unmonitored 51001/51001 192.168.2.252 D N 45921 Unmonitored 51002/51002 192.168.2.254 D N 62379 Unmonitored 3 sip peers [Monitored: 0 online, 0 offline Unmonitored: 3 online, 0 offline] *CLI>
INSTALL ZoiPer:
For my lab I used both the Linux and MAC files.
They have excellent install instructions for linux: http://www.zoiper.com/en/voip-softphone/download/zoiper3#linux/step3
Using the SIP account setup on ZoiPer I used the following:
user / user@host: 51000
Password: 51000
Domain / Outbound Proxy: 192.168.2.252:5060
The user is the information we created in the sip.conf file and the domain is the IP address of my CentOS VM running Asterisk: 192.168.2.252:5060
5060 is the default SIP port.
NOTE: It may be required to open IPTABLES on LINUX to allow udp port 5060 to communicate.
[root@localhost junspace]# iptables -I INPUT -i eth0 -p udp --dport 5060 -j ACCEPT
[root@localhost junspace]# iptables -L | grep sip ACCEPT udp -- anywhere anywhere udp dpt:sip

MAKE A CALL:

I'm going to make a call from 51002 to 51001 and not answer:
-- Executing [51001@default:1] Dial("SIP/51002-00000006", "SIP/51001,10") in new stack == Using SIP RTP CoS mark 5 -- Called SIP/51001 -- SIP/51001-00000007 is ringing -- Nobody picked up in 10000 ms -- Auto fallthrough, channel 'SIP/51002-00000006' status is 'NOANSWER' == Using SIP RTP CoS mark 5
Then I make a call from 51002 to 51001 and pick up:
-- Executing [51001@default:1] Dial("SIP/51002-00000008", "SIP/51001,10") in new stack == Using SIP RTP CoS mark 5 -- Called SIP/51001 -- SIP/51001-00000009 is ringing -- SIP/51001-00000009 answered SIP/51002-00000008 -- Remotely bridging SIP/51002-00000008 and SIP/51001-00000009

HELLO WATSON _ COME HERE!!!!

SUMMARY:

As you can see all of the ZoiPer clients are working now across 2 different Linux machines and a MAC and communicating to a CentOS VM running Asterisk.
Very simple and clean!

No comments:

Post a Comment