Page tree

Applies to VoipNow 3 and higher!

This article describes the SIP trunking feature and how to use it to connect a PBX to an extension. Also, it includes a set of recommendations with examples for seiting up Asterisk to act as a PBX. 

Enable SIP Trunking for a VoipNow extension

When enabled at extension level, this VoipNow feature allows you to connect a PBX to the extension (when a DID assigned to that extension is called, it is passed further to the PBX in the SIP:To header). This option was added because some customers wanted to connect different PBX systems to VoipNow.

In order to enable this feature, you need a SIP trunking license. If the license is valid,  in the Extension → Provisioning and SIP page, under the SIP Preferences area, you'll find the PBX is connected to this extension [] Enable for SIP trunking service option. Select this checkbox, and you will be able to connect a different PBX to that extension.

How to configure Asterisk to act as a PBX

For this, you will need Asterisk box. There are plenty of installation tutorials on the web, so you shouldn't find any difficulty in installing Asterisk.

In our example, ./configure --prefix=/opt is used to set /opt/ as a destination directory for the Asterisk files.

After completing the installation process, you will need to edit the files below:

Example of /opt/etc/asterisk/modules.conf

[modules] 
autoload=yes				
noload => pbx_gtkconsole.so				
noload => pbx_spool.so				
noload => chan_skinny.so				
noload => res_smdi.so				
noload => pbx_ael.so				
noload => app_voicemail.so				
load => res_musiconhold.so				
noload => chan_alsa.so				
noload => chan_console.so


Example of /opt/etc/asterisk/sip.conf

[general]				
defaultexpirey=3600			
maxexpirey=3600				
disallow = all				
allow = g729				
allow = ulaw				
allow = alaw				
bindaddr = asterisk_server_ip				
port = 5060				
context = phones				
nat = no			
domain = your_server_ip			
register => 0003*001:password@voipnow_server_ip/0003*001

[mysip]				
fromuser = 0003*001				
fromdomain = asterisk_server_ip				
defaultuser = 0003*001				
authuser = 0003*001				
dtmfmode = rfc2833				
dtmf = rfc2833				
disallow = all				
allow = g729				
allow = ulaw				
allow = alaw				
type=peer				
host = voipnow_server_ip				
qualify = yes				
nat = no			
context = from-voip-provider				
canreinvite = yes	

[5000]				
type=friend				
defaultuser = 5000				
secret = secret				
qualify=yes				
nat=no				
host=dynamic				
canreinvite=no				
disallow=all				
allow=alaw				
context=phones


The example above registers the local Asterisk PBX to the VoipNow system using extension 0003*001. Make sure the extension has SIP trunking enabled on the VoipNow server. 5000 is a local Asterisk extension that will be used for both incoming and outgoing calls.

Example of /opt/etc/asterisk/extensions.conf

[general]				
static=yes				
writeprotect=no				
clearglobalvars=no	

[phones]				
exten => 5000,1,Dial(SIP/5000)				
exten => _X.,1,Dial(SIP/${EXTEN}@mysip)				
exten => _X.,2,Hangup

[from-voip-provider]				
exten => 18002304043,1,Dial(SIP/5000)				
exten => _X.,1,Congestion()

This is a basic example of Asterisk dialplan that can place outgoing calls and receive incoming calls. 5000 is the only local extension. The rest of the prefixes matching _X. get forwarded through the mysip channel. The[from-voip-provider] context is used for incoming calls.

To launch Asterisk, run the following:

/opt/sbin/asterisk -f -g -U asterisk -G asterisk


Test the configuration

For example, if you want to register the 5000 extension using a X-Lite softphone, you need to open its SIP accounts → Properties menu page and set:

  • User name: 5000
  • Password: secret
  • Authorization user name: 5000
  • Domain: asterisk_server_ip

To call a different extension (e.g. 0003*002) from the Asterisk PBX, you need to simply dial 0003*002).

To take incoming calls via VoipNow on extension 5000, the [from-voip-provider] context needs to be added. When configuring your /opt/etc/asterisk/extensions.conf file, you must replace the 18002304043 example with the DID number assigned to your account by your SIP provider.

Note that 18002304043 is a DID number assigned in the VoipNow interface for the specific extension with enabled SIP trunking.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.