free tracking

Jun 22, 2013

Making Your First Asterisk Call On a Single Machine

Using virtualization, we can try executing a basic Asterisk dialplan and make a SIP call between two Windows machines.


1. Fully setup Asterisk call manager on your Linux Machine with configuration all set to default
2. Softphone applications (3CX) on Windows 7 host and Windows XP guest
3. Enabled Microsoft Loopback Adapter on Windows 7 host
4. Knowledge on basic networking (LAN connectivity)

Setup LAN Connectivity

All three machines must be on the same subnet. This is the IP configuration I used in this scenario:

Windows 7 host [Microsft Loopback Adapter]
IP Address:
Subnet mask:

Windows XP guest
IP address:
Subnet mask:

Ubuntu guest
IP address:
Subnet mask:

Now we need to test our virtualized LAN connectivity. All machines must be able to ping each other. This is possible using the Microsoft Loopack Adapter on our host machine.

Setup Asterisk

This is the default script for our asterisk.conf
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk

verbose = 3
;debug = 3
;alwaysfork = yes        ; Same as -F at startup.
;nofork = yes            ; Same as -f at startup.
;quiet = yes            ; Same as -q at startup.
;timestamp = yes        ; Same as -T at startup.
;execincludes = yes        ; Support #exec in config files.
;console = yes            ; Run as console (same as -c at startup).
;highpriority = yes        ; Run realtime priority (same as -p at
                ; startup).
;initcrypto = yes        ; Initialize crypto keys (same as -i at
                ; startup).
;nocolor = yes            ; Disable console colors.
;dontwarn = yes            ; Disable some warnings.
;dumpcore = yes            ; Dump core on crash (same as -g at startup).
;languageprefix = yes        ; Use the new sound prefix path syntax.
;internal_timing = yes
;systemname = my_system_name    ; Prefix uniqueid with a system name for
                ; Global uniqueness issues.
;autosystemname = yes        ; Automatically set systemname to hostname,
                ; uses 'localhost' on failure, or systemname if
                ; set.
;maxcalls = 10            ; Maximum amount of calls allowed.
;maxload = 0.9            ; Asterisk stops accepting new calls if the
                ; load average exceed this limit.
;maxfiles = 1000        ; Maximum amount of openfiles.
;minmemfree = 1            ; In MBs, Asterisk stops accepting new calls if
                ; the amount of free memory falls below this
                ; watermark.
;cache_record_files = yes    ; Cache recorded sound files to another
                ; directory during recording.
;record_cache_dir = /tmp    ; Specify cache directory (used in conjunction
                ; with cache_record_files).
;transmit_silence = yes        ; Transmit silence while a channel is in a
                ; waiting state, a recording only state, or
                ; when DTMF is being generated.  Note that the
                ; silence internally is generated in raw signed
                ; linear format. This means that it must be
                ; transcoded into the native format of the
                ; channel before it can be sent to the device.
                ; It is for this reason that this is optional,
                ; as it may result in requiring a temporary
                ; codec translation path for a channel that may
                ; not otherwise require one.
;transcode_via_sln = yes    ; Build transcode paths via SLINEAR, instead of
                ; directly.
runuser = asteriskpbx        ; The user to run as.
rungroup = asteriskpbx        ; The group to run as.
;lightbackground = yes        ; If your terminal is set for a light-colored
                ; background.
;forceblackbackground = yes     ; Force the background of the terminal to be 
                                ; black, in order for terminal colors to show
                                ; up properly.
;defaultlanguage = en           ; Default language
documentation_language = en_US    ; Set the language you want documentation
                ; displayed in. Value is in the same format as
                ; locale names.
;hideconnect = yes        ; Hide messages displayed when a remote console
                ; connects and disconnects.
;lockconfdir = no        ; Protect the directory containing the
                ; configuration files (/etc/asterisk) with a
                ; lock.

; Changing the following lines may compromise your security.
;astctlpermissions = 0660
;astctlowner = root
;astctlgroup = apache
;astctl = asterisk.ctl


In sip.conf, we set the extensions of the two calling parties to '10013' and '10014' and secret to 'asterisk'. Take note of the context ‘LocalSets’ which we will use next in our dialplan.




This basic dialplan simply tells Asterisk how to handle calls to and from our machines.


exten => 10013,1,Dial(SIP/10013)

exten => 10014,1,Dial(SIP/10014)

The Asterisk CLI
asteriskpbx@Ubuntu:~$ asterisk -r
Asterisk SVN-branch-1.8-r380210, Copyright (C) 1999 - 2012 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.
Running as user 'asteriskpbx'
Running under group 'asteriskpbx'
Connected to Asterisk SVN-branch-1.8-r380210 currently running on Ubuntu (pid = 1896)
Verbosity is at least 3

Enter the following commands:
sip reload
dialplan reload

3CX Phone

On Windows 7 host

On Windows XP guest

Note that the password here is 'asterisk' which is the secret we configured in sip.conf. The IP address of the PBX server is ''

If this setup is successful, you will be able to see this output when you run the command 'sip show users' on Asterisk CLI. This means that our phones have successfully registered in Asterisk.

You can now try your first call by dialing '10014' on Windows 7 host and our phone on Windows XP guest will ring.

This will be the output in Asterisk CLI during the call.


Post a Comment

About Me

aspiring computer and network engineer, programmer, with fascination in webdesign and development

Connect with me

Twitter  GooglePlus  Facebook  LinkedIn  Blogger


Featured Post