FreeBSD Asterisk test between 2 extensions

Asterisk — Open source PBX system. Developed by Mark Spencer. Working on Linux, FreeBSD, OpenBSD and Solaris operation systems. The project name created from “*”. You can read more about asterisk from http://asterisk.ru/ and http://www.asterisk.org/ official page.

Asterisk have all features which have in any hardware PBX’s. Supports a lots of VoIP protocols.

Features:

  • Voice Mail
  • Conference rooms
  • IVR menu
  • Call handling center(By using different algorithms, define call queueing and distribution to subscribers)
  • Call Detail Record

Network topology will be as follows:
Net-VoIP-Asterisk-Topology

Installation.
Our server DNS name is asterisk.unixmen.com.
We wil install Asterisk13 to FreeBSD 10.1 x64 server:
# cd /usr/ports/net/asterisk13/     – Go to the port path
# make config                       – Choose the needed modules
Asterisk-modules
# make -DBATCH install              – Install

# echo ‘asterisk_enable=”YES”‘ >> /etc/rc.conf  – Add to StartUP
# /usr/local/etc/rc.d/asterisk start            – Start the daemon

In the /usr/local/etc/asterisk/sip.conf file change lines below:
transport=udp,tcp
tcpenable=yes

Add the line below to the end of /usr/local/etc/asterisk/sip.conf file and save file(We included new sip_additional.conf configuration file):
#include sip_additional.conf

Add the line below to the end of /usr/local/etc/asterisk/extensions.conf file and save file(We included new extensions_fs.conf file):
#include extensions_fs.conf

In the /usr/local/etc/asterisk/sip_additional.conf configuration file create 2 sip extensions(7000 and 7001):
[7000]
defaultuser=7000
secret=freebsd
host=dynamic
context=phones
qualify=yes
transport=udp,tcp
insecure=port,invite
canreinvite=no
disallow=all
allow=alaw
type=friend

[7001]
defaultuser=7001
secret=freebsd
host=dynamic
context=phones
qualify=yes
transport=udp,tcp
insecure=port,invite
canreinvite=no
disallow=all
allow=alaw
type=friend

/usr/local/etc/asterisk/extensions_fs.conf configuration file content will be as follow:
[incoming]
exten => _7XXX,1,Dial(SIP/${EXTEN})
exten => _7XXX,n,Hangup()

[outgoing]
exten => _1XXX,1,Dial(SIP/${EXTEN})
exten => _1XXX,n,Hangup()

[phones]
include => incoming
include => outgoing

# /usr/local/etc/rc.d/asterisk restart – Restart the service

Or if you want to immediately work al changes, you can use command below from Asterisk console:
asterisk*CLI> sip reload

At the end go to the Asterisk console with verbose mode and check the connections(As you see 7000 and 7001 SIP phones are already connected):
# asterisk -rvvv
asterisk*CLI> sip show peers
Name/username  Host             Dyn Forcerport Comedia  ACL   Port  Status Description
7000/7000    217.168.188.211 D   Auto(No)  No     41735 OK(45 ms)
7001/7001    98.88.81.154    D   Auto(No)  No     41247  OK(1 ms)
3 sip peers [Monitored: 3 online, 0 offline Unmonitored: 0 online, 0 offline]

For SIP debug you can use the command below:
snort*CLI> sip set debug on

You can see the newly created dialplan phones with the command below:
snort*CLI> dialplan show phones
[ Context ‘phones’ created by ‘pbx_config’ ]
Include =>        ‘incoming’                                    [pbx_config]
Include =>        ‘outgoing’                                    [pbx_config]

-= 0 extensions (0 priorities) in 1 context. =-

At the end configure two SIP soft or hard phones with 7000 and 7001 extensions and call from one to another. For Android(have internal too) and AppleIOS you can use the Zoiper SIP client. For Linux, Windows(Zoiper and X-lite have too), MAC desktop you can use thee Jitsi client.