Asterisk

Asterisk is a complete PBX (private branch exchange) in software. It runs on Linux, BSD, Windows and macOS and provides all of the features you would expect from a PBX and more. Asterisk does voice over IP in four protocols, and can interoperate with almost all standards-based telephony equipment using relatively inexpensive hardware.

Asterisk provides voice-mail services with directory, call conferencing, interactive voice response and call queuing. It has support for three-way calling, caller ID services, ADSI, IAX, SIP, H.323 (as both client and gateway), MGCP (call manager only) and SCCP/Skinny.

This article will show you how to configure a simple in house network enabling us to use a SIP softphone to talk to another SIP softphone on your LAN.

Installation

Install the asteriskAUR package. If you are using Cisco-based phones it is recommended to use the asterisk-ciscoAUR package instead as this is pre-patched with the presence patch. (See Issue 13145).

Alternatively, you can install the asterisk-lts-18AUR package to have a long-term support release (current latest LTS major version is Asterisk 18). Asterisk LTS releases tend to have fewer features, but will be maintained for much longer. See the Asterisk Versions page for complete details about the release cycle for all Asterisk versions. Once Asterisk 21 is released in October 2023 (estimated), the maintainer of asterisk-lts-18AUR intends to create the nonexistent package asterisk-lts-20. Asterisk 20 is planned to be released in October 2022, which the asteriskAUR package will eventually update to until it switches to Asterisk 21 by the end of 2023.

Start the server with asterisk.service.

You will also need a SIP softphone and at least two machines. Recommendations for SIP phones are Blink (blinkAUR), Linphone (liblinphone-gitAUR) or X-Lite (xlite-binAUR).

To enable ilbc codec support add the following to the very beginning of the build section of the PKGBUILD:

cd ${srcdir}/${pkgname}-${pkgver}/contrib/scripts
echo | ./get_ilbc_source.sh

Configuration

Note that the following instructions assume that you want to use already obsoleted sip module. The sip module is no longer maintained, but is easier to configure then the newer module. There is a summary of configuration changes between two modules, as well as instructions on how to migrate to the newer module, on the Asterisk wiki.

In order to use sip, you need to explicitly load the older module, and ensure that the newer module is unloaded. In adjust the following:

SIP

Add this to the following file:

This creates our two SIP users and me2 with a password of in the house context. The context will be defined next.

Add this to the following file:

This creates the context house and assigns extension 100 to the SIP user , and extension 101 to the SIP user me2.

Now all thats left is to see if it works.

Music on hold

Music on hold is a really sweet feature. And once again easy to install and configure. Edit and add, or make sure it is uncommented:

And that is all there is to it. Just copy your favorite legally obtained MP3 to .

Voicemail

Voicemail is another feature of asterisk. There are many ways to configure it, however this article only covers a simple approach.

Create/edit your :

What does this mean? Most of the is pretty self-explanatory. However, do note that if you have postfix set up right the PBX will send an email notifying the user of a new voice-mail and if attach=yes is defined it will attach the file.

Now for the actual mailbox. The format is:

mailbox => password,user,email

In this case, we gave 'Me' (email me@mydomain.com) mailbox 100, with a password of 1234.

Now we have to have a way to leave messages to this voice-mail, and a way to access it. For this, we go back to the and modify your existing entry as follows:

exten => 100,1,Dial(SIP/me1,20)
exten => 100,n,Voicemail(u100@default)

The 20 on the end of the first 'exten' tells 'Dial()' to call for 20 seconds. If no one answers it heads to voice-mail box 100 in the default context.

Next is actually accessing your voicemail. For this we add:

exten => 600,1,VoiceMailMain,s100@default

So when we call 600, the application 'VoiceMailMain' goes to 100 in the default context. The allows for automatic login.

Note: The 'VoiceMail' applications have a significant amount of options, so it is suggested reading over some additional documentation. This is just for a basic, home use setup. Also note that it is generally a good idea to use extensions higher then your users extensions for accessing 'VoiceMail'. This way someone dialing 208 does not hit someone's voice-mail at 205.

Connecting to the PSTN

Now that you have the previous setup, it is time to actually connect to the outside world. To do this, you will need a provider such as OnSIP. Your provider should have instructions on connecting to asterisk, so this section is very general.

extensions.conf
  • In the outbound context, any number dialed will be sent out to your service provider. The 'whatever' in the 2 priority should match what you have in your .
  • Of course, the inbound dial-plan can be modified to do what you want. For instance, you can have so when someone calls your number they are routed to your SIP phone on your computer. Then add in voice-mail and so on.
iax.conf

The first step is to log into FWD and enable their side of IAX. It is under extra features, and keep in mind that the authors claim it takes a little while to activate.

Now edit your iax.conf with the following in the 'general' section:

And at the bottom add:

This allows calls from FWD.

extensions.conf

Place this at the top under '[globals]':

Next, add this to a context for outgoing:

exten => _393.,1,SetCallerId,${FWDCIDNAME}
exten => _393.,2,Dial(IAX2/${FWDNUMBER}:${FWDPASSWORD}@iax2.fwdnet.net/${EXTEN:3},60,r)
exten => _393.,3,Congestion

You can change the '393' to whatever you want. This is what you will dial before dialing a 'fwd' number. For instance, to dial '744561' you would dial '393744561'.

And lastly, the incoming calls:

Extensions to try calling are 55555 (a volunteer maned test line) and 514 (conference).

Sounds

Sounds are stored in the folder , stands for the code of the language for example "en" for English. To add new sounds copy them to the folder. Preserve the following folder structure:

Edit the language parameter in the

Possible sources for sounds are:

MeetMe

MeetMe is the application that allows you to do conference calling. Same as everything, basic setup is easy.

Edit :

conf => 1000

Next is :

exten => 999,1,MeetMe(1000|M)

Now dial 999 to get into conference 1000. The enables music on hold if no one is in there. It will automatically go away when someone joins the conference.

Asterisk console and softphones

Now lets get Asterisk going:

# asterisk -vvvvvvc

This will give us the Asterisk CLI with verbose output. If Asterisk is already running you will need to use:

# asterisk -r

Now fire up your SIP clients and set them up with the information in the sip.conf. Switch back to your Asterisk CLI and you should see:

Registered SIP 'me1' at 192.168.0.142 port 5061 expires 60

Now you should be able to dial 101 from and talk to .

Troubleshooting

If you receive a 404 Not Found error check your and the number you dialed.

gollark: https://xkcd.com/1962/
gollark: Also: this is the canonical generation list.
gollark: University is still moderately subsidised now.
gollark: It was still cheaper then. The costs of education and stuff have gone up a lot relative to inflation for ?????? reasons.
gollark: I think £20 or so each, less if you buy in bulk.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.