How to set up a SIP trunk in the Asterisk PBX

In my previous article we configured Asterisk with some SIP-devices, and created a basic dialplan so that they could dial eachother. We also created two additional extensions for test purposes. This time I will show you how to configure a SIP trunk, and add extensions in the dialplan so that the telephones can dial out through the trunk. And if you also have a telephone number (DID) associated with the trunk, for others to be able to dial your phones, through your Asterisk PBX.

What is a SIP trunk?

A SIP trunk is often defined using many buzz- and marketing words throughout the web, but, what it basically is, is a two-way connection to a VOIP-provider, that routes the calls you send to it, out on the PSTN for you, and charges you for the calls you make. If you also have a DID (Direct Inward Dialing) number at the provider, calls made to you are forwarded to your Asterisk PBX, then you switch the calls as you see fit. Through a trunk, many calls can be sent, the limit is only your bandwidth and computer resources at the machine where your Asterisk runs, unless your VOIP-provider, or you for that matter, limit the number of calls in some way (by configuring the PBX at either end of the trunk), that are allowed to go through it. Continue reading “How to set up a SIP trunk in the Asterisk PBX”

An introduction to Asterisk, The Open Source Telephony Project

Asterisk is software that turns an ordinary computer into a voice communications server. Asterisk is the world’s most powerful and popular telephony development tool-kit. It is used by small businesses, large businesses, call centers, carriers and governments worldwide. Asterisk is open source and is available free to all under the terms of the GPL.

That is what the Asterisk website describes Asterisk as. I thought I should write a little about it, since it is quite a high first step, to start using and experimenting with it the first time, atleast I found it so, when I first did. Like with many things, there are good, and bad, documentation, and sources thereof. Sometimes both kinds are found in the same place, and it is up to you to judge on the quality. This is quite frustrating when you are looking for answers and don’t already know, or are able to judge, which is correct, and which is not.

Get the book

Asterisk: The Definitive Guide: Open Source Telephony for the Enterprise 5th Edition
Asterisk: The Definitive Guide: Open Source Telephony for the Enterprise 5th Edition

Let’s get started

I will now describe, in a how-to manner, to get you started, how to install Asterisk in Debian GNU/Linux, connect two SIP devices (telephones), and create a minimal dialplan so that they can call each other. I do not use any web-frontend or GUI, just the configuration files. You will find that it gives the best control and understanding of how things work, if you just take it one step at a time, and learn what you are doing.

What we need is:

  • A machine running Debian GNU/Linux
  • Asterisk itself (Asterisk is packaged in Debian.)
  • Two SIP telephones, “softphones”, or “hardware” telephones using SIP

I presume that you have basic knowledge of package installation and standard Unix tools, and know how to use a text editor of your choice. Allright, let’s begin.

Continue reading “An introduction to Asterisk, The Open Source Telephony Project”