- Basic Install
- Connect a Device
- Connect a Call
Asterisk has been a maintained package with OpenBSD ports/telephony for a long time. The following will review some installation tips based on the packages and getting a basic configuration up and running.
The OReilly Book: Asterisk: The Future of Telephony is actually still relevant, but you want to use the most current 'online' version which covers Asterisk 1.8, which has some subtle configuration 'advantages' you want to emphasise.
mkdir -p /var/pkg/cache export PKG_CACHE=/var/pkg/cache export PKG_PATH=$PKG_CACHE/:non-local/package/repository/
For our configuration, we're installing the following packages, which may have their own dependencies:
The packages install their dependencies and give fair warning of additional information you need to review:
When we/you have an idea what you actually use/need, then we can trim down the above modules, but in our discovery stage we're just putting everything in.
Override Resource Limits
Once your PBX system is fully operational, it's going to use up a fair amount of resources, more than the basic service install will use. So, we are going to redefine the resource allocation for Asterisk, and record those changes in the login.conf
File extract: /etc/login.conf
asterisk:\ :openfiles-cur=512:\ :openfiles-max=65535:\ :tc=daemon:
Once you've made modification such as the above login.conf, make sure you update the database by executing
$ sudo cap_makedb /etc/login.conf
As per our above configuration in login.conf, you'll want to ensure that your local user account is now connected using the new filesize limits, by using something like vipw, or usermod(8) "-L login-class" to set the login class:
- _asterisk --> login class --> asterisk
$ sudo usermod -L asterisk _asterisk
vipw File extract /etc/passwd:
_asterisk:*************:545:545:asterisk:0:0:PBX Phone System:/var/spool/asterisk:/bin/ksh
The above installation creates the startup scripts:
stored in /etc/rc.d/
To automatically start/shutdown the daemons during system restarts, reference them in the /etc/rc.conf.locals line
The 'safe' way for starting, stopping, and reloading Asterisk is with the provided script.
Review /usr/local/share/doc/pkg-readmes for:
The wonderful thing about the packaged system, is that it basically just works. You can refer to the documentation and update the initial configuration, later.
There are apparently different types of ringtones, depending on the country your in, so one of the simple settings is to let Asterisk know what tunes to play when your phone rings.
The "country" option is related to further [au], [gb] tags in the file, so you can't just pick a random two letter acronym and expect it to work.
Verify installation behaviour by running Asterisk in foreground mode ("-c" control console) with some "-v verbose" output so we can take a peak into it's activities.
$ sudo /usr/local/sbin/asterisk -cvvv
If Asterisk has been successfully installed, you should a screen response such as the below:
... ... Asterisk Ready.
Run the Asterisk CLI module show command, to list the number of modules installed in your configuration.
*CLI> module show
... very long list ... 203 modules loaded
Woohoo, Asterisk has been successfully installed, together with some modules we want to use (if we knew how to use them.)
The better way for a clean shutdown (although it will terminate existing calls) is to use the command core stop now
*CLI> core stop now
$ sudo /etc/rc.d/asterisk start
Connect a Device
Before a device can successfully send and recieve calls Asterisk must be made aware of the device, likewise the device needs to be configured to connect with the Asterisk server.
- Softphones are Software based phones.
- Hardphones are hardware devices.
Devices connect and communicate with Asterisk over a 'channel'. The two channels we'll review are SIP (configured in sip.conf) and IAX2 (configured in iax.conf)
[Ref: sip docs]
Extend on the existing sample configuration file:
[general] disallow=all allow=ulaw  type=friend secret=<<something>> nat=yes host=dynamic directmedia=no qualify=yes mailbox=100 context=default
Configure our softphone to connect to the above server, with the details mentioned for user: 100
We can configure the software SIP client, Jitsi, and monitor the registration process by using the "console" output as above, /usr/local/sbin/asterisk -cvvv
Basic configuration for Jitsi 1.0
- File --> Add New Account
- Network: --> select: SIP
- Username: 100@ip-address-of-asterisk-host
- Password: <<something>> as above
- click: Add
After successfully configuring your Jitsi client, you should see the console report:
-- Registered SIP '100' at my-ip-address:5060 [Mnth DD HH:MM:SS:] **NOTICE**: **chan_sip.c:20788 handle_response_peerpoke:** Peer '100' is now Reachable.
*CLI> sip show peers
Name/username Host Dyn Forceport ACL Port Status 100/100 (my-ip-address) D N 5060 OK (22 ms) 101 (unspecified) D N 0 UNKNOWN
*CLI> sip show peer 100
Name : 100 ... ... User Reason : No Encryption : No
[ Ref: sip.conf]
Sample configuration is at: /usr/local/share/examples/asterisk/default/iax.conf
[general] srvlookup=yes bandwidth=high jitterbuffer=no forcejitterbuffer=no autokill=yes auth=plaintext host=dynamic disallow=all allow= 
From the asterisk console
module load chan_iax2
Connect a Call
- Chat XMPP