Softpanorama

Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Skepticism and critical thinking is not panacea, but can help to understand the world better

Asterisk -- The Open Source PBX

Old News Asterisk The Open Source PBX
(main page)
Recommended Links Installation Reference  
Starting and Stopping Asterisk CLI Debugging Dialplan Basics Asterisk variables Users, Peers and Friends
Configuration Applications Festival Hardware requrements Humor Etc

Having a fully functional PBX system is not a big problem anymore. Asterisk allow you to have a working PBX installed on any PC running GNU/Linux without spending a lot of money.

Asterisk was created by Mark Spencer of Digium in 1991. Like any PBX, it allows a number of attached telephones (extensions) to make calls to one another, and to connect to other telephone services including the public switched telephone network (PSTN).

The basic Asterisk software provides all of the features you would expect from a proprietary PBX including: voicemail, conference calling, interactive voice response (IVR), and automatic call distribution (queue). These are just a few of the features that it can provide, you can view a list of supported features at Asterisk's Web site.

Users can create extend functionality by writing dial plan scripts, by adding custom modules written in C, or by writing Asterisk Gateway Interface (AGI) scripts in Perl or other scripting languages. Asterisk also supports a wide range of Voice over IP protocols, including SIP and H.323.

An Asterisk server can be configured for call origination (calling card gateways), call termination (wholesale), call distribution (pointing DIDs to PSTN numbers or VoIP adapters) or all of them at the same time. Its flexible architecture allows combining regular PSTN lines and SIP trunks to accomplish the above mentioned setups. Analog cards with fxs and fxo ports as well Digital cards with E1 and T1 ports are available; brands such as Digium, Sangoma and Rhino are among the most used.

Asterisk does not require a PSTN line connected to it but it does not automatically garantee you any savings.  You need to configure your PBX with just one SIP trunk to a VoIP provider and point DIDs from any country (where available).

One of the advantages is the ability to use phone numbers local to the area of most calls even if you reside outside of this area. For example European business selling goods in NYC can have NYC local number.

Installation on some version of Linux  (for example Ubuntu 9.10) can be done from precompiled packages.

Configuration can be done by editing files or via GUI. FreePBX and Trixbox are two popular example of Asterist with the GUI (Trixbox is all-in-one package that includes OS -- CentOS).

NEWS CONTENTS

Old News ;-)

[Jan 27, 2020] How to configure an Asterisk dialplan for intra-office calling Enable Sysadmin

Jan 27, 2020 | www.redhat.com

How to configure an Asterisk dialplan for intra-office calling Learn how to configure Asterisk to let two softphones call each other.

Posted January 21, 2020 | by Anthony Critelli

Image
"Telephone - Amalgamated Wireless of Australasia, 300 CBT, circa 1940" is licensed under CC BY 4.0
In the previous article , you learned how to configure the PJSIP channel driver to connect a simple softphone client with your Asterisk installation. However, your phones still can't call each other, and you haven't given them numerical "extensions" yet. Connecting channels together in Asterisk is the work of the dialplan. In this article, you'll learn the basics of the dialplan: What it is, how it's configured, and how to use it to connect phones together.

As a reminder, this is the setup we're configuring:

Image
Network diagram credit: https://extensions.libreoffice.org/extensions/vrt-network-equipment
Dialplan fundamentals

The Asterisk dialplan is responsible for routing calls, so it is often referred to as the heart of an Asterisk system. The dialplan is written in a special scripting language, and it is extremely powerful. You might think of phone systems as simply accepting and connecting calls, but Asterisk is capable of much more. With the dialplan, you can design rich, voice-driven applications. For example, you could create the following call flow for a small business:

  1. An external call comes into Asterisk from a standard telephone number.
  2. An Interactive Voice Response (IVR) system might ask the user to enter basic information, such as their account number.
  3. Asterisk accepts the user's input. The IVR looks up their account and presents them with information (e.g., information about outstanding invoices).
  4. Optionally, the user can be routed to a queue of available customer service representatives. When the employee receives the customer's call, the system provides them with all of the customer's details and saves the caller some time.

While there are other programming interfaces for interacting with Asterisk, the dialplan is the most basic, and understanding it is fundamental to understanding how Asterisk handles calls. According to Asterisk the Definitive Guide , there are four fundamental components to the Asterisk dialplan:

If you're new to Asterisk, this breakdown probably sounds complicated. While Asterisk dialplans certainly can be complex, a simple phone system only requires a simple dialplan. Let's take a look at the dialplan needed to support your intra-office calling scenario. The dialplan is configured in /etc/asterisk/extensions.conf :

[office-phones]

exten => 1001,1,Dial(PJSIP/alice-softphone)

exten => 1002,1,Dial(PJSIP/bob-softphone)

The snippet above is all that is necessary to allow your two phones to call each other. Let's step through each part of this dialplan:

To recap: When a call comes into the office-phones context, Asterisk tries matching that call to an extension. When extension 1001 is dialed, the first step (priority) tells Asterisk to dial the PJSIP endpoint for Alice's phone. When extension 1002 is dialed, the same thing happens for Bob's phone.

This is great so far, but how exactly does a call make its way into the dialplan? The answer lies in the PJSIP endpoint configuration from the previous article:

[alice-softphone]
type=endpoint
context=office-phones
disallow=all
allow=ulaw
auth=alice-auth
aors=alice-softphone
More Linux resources

Notice that the context for each phone is set to office-phones . This setting tells Asterisk that any calls coming from the alice-softphone or bob-softphone endpoints should enter the dialplan in the office-phones context. When Bob dials a number (say, 9000) from his softphone, Asterisk looks in the office-phones context for the matching extension 9000. In the sample dialplan above, this call will fail because there is no matching extension.

You don't have to configure all of your phones to enter the dialplan in the same context. In fact, you'll likely find good reasons to specifically put phones in other contexts. Consider a business that wants to only allow certain people to make international calls, while everyone else is restricted to local calls. You might have two extensions: One to allow unrestricted calling, and one that only allows calls to numbers that start with the local area code. Those with international calling privileges would be placed in the international context, while everyone else would be placed in the local-only context.

That was a lot of theory. Let's get back to the command line and test out the changes that we made to the dialplan. First, you must non-disruptively reload the dialplan to enact the changes you made in the config file:

asterisk-1*CLI> dialplan reload
Dialplan reloaded.

Next, you can inspect the dialplan directly from the Asterisk CLI to ensure that your changes are present:

asterisk-1*CLI> dialplan show office-phones
[ Context 'office-phones' created by 'pbx_config' ]
   '1001' => 1. Dial(PJSIP/alice-softphone) [extensions.conf:3]
   '1002' => 1. Dial(PJSIP/bob-softphone) [extensions.conf:5]

-= 2 extensions (2 priorities) in 1 context. =-

Notice that Asterisk includes the exact file name and line number where an extension and its priority can be found. This information is useful when troubleshooting behavior in your phone system.

With the dialplan reloaded and your changes clearly in place, you should be able to place a test call from Linphone (or whatever SIP endpoint you're using). First, launch the Asterisk CLI with extra verbosity using asterisk -rvvv :

[root@asterisk-1 asterisk]# asterisk -rvvv
Asterisk 16.6.1, Copyright (C) 1999 - 2018, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
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.
=========================================================================
Connected to Asterisk 16.6.1 currently running on asterisk-1 (pid = 4138)

Next, place a call from Alice's phone to extension 1002. Assuming that you registered an additional softphone (or physical phone) for Bob, the extension should show as ringing :

Image

The Asterisk CLI also prints informational messages about the call's progression since it was set to verbose mode. You can see the inbound call being handled by the dialplan and handed off to the PJSIP channel driver to dial Bob's softphone. Eventually, once Bob answers, Asterisk bridges the audio for the call together so that both parties can hear each other:

 == Setting global variable 'SIPDOMAIN' to 'asterisk-1.acritelli.com'
                  -- Executing [1002@office-phones:1] Dial("PJSIP/alice-softphone-00000008", "PJSIP/bob-softphone") in new stack
                  -- Called PJSIP/bob-softphone
                  -- PJSIP/bob-softphone-00000009 is ringing
                  -- PJSIP/bob-softphone-00000009 is ringing
                  -- PJSIP/bob-softphone-00000009 answered PJSIP/alice-softphone-00000008
                  -- Channel PJSIP/bob-softphone-00000009 joined 'simple_bridge' basic-bridge <edd9402c-6df0-4fff-a81e-57826dadc652>
                  -- Channel PJSIP/alice-softphone-00000008 joined 'simple_bridge' basic-bridge <edd9402c-6df0-4fff-a81e-57826dadc652>
                  -- Channel PJSIP/bob-softphone-00000009 left 'native_rtp' basic-bridge <edd9402c-6df0-4fff-a81e-57826dadc652>
                  -- Channel PJSIP/alice-softphone-00000008 left 'native_rtp' basic-bridge <edd9402c-6df0-4fff-a81e-57826dadc652>
 == Spawn extension (office-phones, 1002, 1) exited non-zero on 'PJSIP/alice-softphone-00000008'
asterisk-1*CLI>

You have now created enough Asterisk configuration to allow both of your phones to call each other. Congratulations!

Adding another extension

You've now seen basic dialplan configuration that allows two phones to call each other. I also mentioned a few times that Asterisk decouples the concept of a physical phone from an extension because an extension is simply a set of instructions in the dialplan. Let's add another simple extension to the dialplan to see exactly what I mean:

[office-phones]

exten => 1001,1,Dial(PJSIP/alice-softphone)

exten => 1002,1,Dial(PJSIP/bob-softphone)

exten => 9000,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()

The above configuration adds an additional extension (9000) to the dialplan. When this extension is dialed, Asterisk:

  1. Answers the call.
  2. Plays a hello-world file. This is a sound file included with Asterisk. By default, Asterisk searches for sounds in /usr/lib/asterisk/sounds/ .
  3. Hangs up the call.

Notice the use of the same => n syntax. This is a common and helpful bit of syntactic sugar in the dialplan. Remember that each extension has one or more priorities , or steps, associated with it. The same => n syntax saves you some typing and tells Asterisk that this step is just the next priority for the same extension. The above configuration could also be written as:

exten => 9000,1,Answer()
exten => 9000,2,Playback(hello-world)
exten => 9000,3,Hangup()

With your new configuration in place, reload the dialplan and try dialing extension 9000 to see what happens. Again, the key concept to understand is that you have created an extension that has no physical device associated with it. Asterisk fully decouples the concept of devices and extensions.

Wrapping up

In this article, you learned about the Asterisk dialplan and wrote enough dialplan configuration to enable two phones to call each other. The Asterisk dialplan is extremely powerful, allowing you to build rich communications applications. I strongly recommend that you check out the official Asterisk dialplan documentation and the fifth edition of Asterisk: The Definitive Guide to help you better understand everything that the dialplan has to offer.

In the [next article], you'll work on connecting your phone system to an external provider to enable inbound and outbound calling. [Note: Don't forget to add the link.] Topics: Networking VOIP Anthony Critelli Anthony Critelli is a Linux systems engineer with interests in automation, containerization, tracing, and performance. He started his professional career as a network engineer and eventually made the switch to the Linux systems side of IT. He holds a B.S. and an M.S. More about me

[Jan 26, 2020] Can I connect my landline to the PC and receive calls and make phone calls through this (through the PC) - Quora

Jan 26, 2020 | www.quora.com

Update Cancel

a p d v EoA b QCFY y YNDC U P dtacP a aDju e UuZ s mhNd s IC l w e cAOm r x ss A rfap G NkAPl Which tools are used for monitoring the network traffic and issue in an enterprise network?

You can use any number of tools to monitor your company's network. Some of these tools specialize in just one thing. Wireshark, for example, records and analyzes data traffic.

Co...

(Continue Reading) You dismissed this ad. The feedback you provide will help us show you more relevant content in the future. Undo Answer Wiki 6 Answers Terry Lambert

Terry Lambert , Did kernel and Bluetooth stack work on the iPhone, cell modems on Chromebooks Answered Mar 28, 2019 · Author has 11.7k answers and 33.3m answer views

Yes.

A landline is an analog telephony line, and is usually called a POTS ( Plain Old Telephone Service ) line.

You can put an analog telephony card into a PC that has slots for cards.

This is pretty much how you build your own PBX using Asterisk .

You can also use digital telephony cards to provide connectivity for VOIP handsets within your office.

Typically these handsets are what are known as "IP Phones".


If you want to do this with a laptop, you can do it with a USB dongle.

You can still find USB interfaces "voice modems", such as the US Robotics USR5637 56K USB Controller Dial-Up External Fax Mo...

Continue Reading Loading

Yes.

A landline is an analog telephony line, and is usually called a POTS ( Plain Old Telephone Service ) line.

You can put an analog telephony card into a PC that has slots for cards.

This is pretty much how you build your own PBX using Asterisk .

You can also use digital telephony cards to provide connectivity for VOIP handsets within your office.

Typically these handsets are what are known as "IP Phones".


If you want to do this with a laptop, you can do it with a USB dongle.

You can still find USB interfaces "voice modems", such as the US Robotics USR5637 56K USB Controller Dial-Up External Fax Modem with Voice available for sale at various locations.

There are also cheaper versions, but they are a crap shoot as to whether they're going to work very well or not. The Conexant ones, which are used in the Imported520 products are about 1/6th the price of the US Robotics, and tend to have good reviews. I've never personally use one. 4.9k views · View 4 Upvoters · View Sharers · Answer requested by Alberto Bucciante Related Questions More Answers Below

Dean Rubine Dean Rubine Former Faculty at Carnegie Mellon School Of Computer Science 1991-1994 Studied at Carnegie Mellon University Graduated 1991 Lives in New Hampshire 4.5m content views 224.9k this month Top Writer 2018 Active in 4 Spaces Dean Rubine Dean Rubine Dean Rubine Former Faculty at Carnegie Mellon School Of Computer Science 1991-1994 Studied at Carnegie Mellon University Graduated 1991 Lives in New Hampshire 4.5m content views 224.9k this month Top Writer 2018 Active in 4 Spaces Dean Rubine , former Faculty at Carnegie Mellon School Of Computer Science (1991-1994) Answered Mar 27, 2019 · Author has 4k answers and 4.5m answer views

You certainly used to be able to back in the nineties. Back then computers usually came with RJ11 jacks to plug them into the phone network so you could access dialup services, even dialup internet. Some of the modems evolved into general phone devices, supporting two way voice audio as well as data.

I actually won a computer in 1993; it was an ASUS with Windows 3.11 if I recall, which was subtitled "Windows for Multimedia" or some such. It had a telephone app (we called them programs back then) that let you use the computer as a speakerphone and answering machine. I think it used the then n...

Continue Reading Loading

You certainly used to be able to back in the nineties. Back then computers usually came with RJ11 jacks to plug them into the phone network so you could access dialup services, even dialup internet. Some of the modems evolved into general phone devices, supporting two way voice audio as well as data.

I actually won a computer in 1993; it was an ASUS with Windows 3.11 if I recall, which was subtitled "Windows for Multimedia" or some such. It had a telephone app (we called them programs back then) that let you use the computer as a speakerphone and answering machine. I think it used the then new TAPI API to control it.

The prize computer has this very goofy feature where it would actually boot up when the phone rang, presumably to fire up the answering machine and take a message. But it took a good fraction of a minute to boot; any caller had long hung up.

These days if you want to use your computer as a phone it's generally a VOIP thing like Skype, going out over the internet to some server which can access the regular phone network. But some offices have VOIP with a local PBX connected to shared local POTS (Plain Old Telephone Service) lines right in the office.

You need to find the right device to let you do it these days. You can probably find a TAPI modem with USB on one end and RJ11 on the other and some software to make it work. I haven't tried it for 25 years so I won't try to be more specific. 2.6k views

s AUY p REfs o qFqqi n giDS s VkeB o Fg r Zhug e wKr d qgAM bpyN b smpJ y bQe WPRi T vvBy e CRiYl l cY l kg o F LDhH M Gg o Ucl b fLS i F l ims e mr Switch to Tello for unbeatable prices. Build your own plan with minutes, text & data and pay only for what you use. No contract, no catch. Start Now You dismissed this ad. The feedback you provide will help us show you more relevant content in the future. Undo John Nakulski John Nakulski , I worked for Australia's largest phone company. Answered Mar 30, 2019 · Author has 1.1k answers and 1.5m answer views

You've described what a Reverse ATA is and does, approximately. I've seen this question here on Quora before. Such devices used to exist. You could put together a solution that does this today, at a little cost and some effort.

You're better off ditching your landline and using Skype or a VoIP service.

If it's for an elderly person or someone with hearing loss ot a disability, get a seniors phone or a seniors video phone. 1.2k views · Answer requested by Alberto Bucciante Chris Summers Chris Summers , Worked in cellphone sales and service for 5 years, computer also for 15 years. Answered May 24, 2019 · Author has 7.9k answers and 5m answer views

PCs use to come with a 56k modem that did just that. You could still do that either by getting a card for a tower or by a USB adapter. There are several programs out there that will also work with this set to use the line as your telephone and you could use a headset with a mic to use the computer as your telephone too. You would need to look on a site like Newegg or tigerdirect for the cards or adapters. 1.3k views · Answer requested by Alberto Bucciante Alberto Bucciante Studied at Universidad De León Lives in Bristol, UK Alberto Bucciante Related Questions More Answers Below

Charles Verrier Charles Verrier , Worked in IT for 30 years Answered Mar 27, 2019 · Author has 1.6k answers and 413.2k answer views

Yes -but not easily.

It used to be called CTI (Computer Telephony Integration) and you could do things like get your PC to dial numbers from a database, or automatically recognise incoming calls and display the contact record for the caller.

There was a software standard called TAPI (Telephony Application Programmers Interface) that standardised the software/hardware interaction, although it suffered from quite bad fragmentation in different manufacturers.

This kind of technology has largely been replaced or superseded by VOIP, so it may be tricky to find hardware or software that still talks ...

Continue Reading Loading

Yes -but not easily.

It used to be called CTI (Computer Telephony Integration) and you could do things like get your PC to dial numbers from a database, or automatically recognise incoming calls and display the contact record for the caller.

There was a software standard called TAPI (Telephony Application Programmers Interface) that standardised the software/hardware interaction, although it suffered from quite bad fragmentation in different manufacturers.

This kind of technology has largely been replaced or superseded by VOIP, so it may be tricky to find hardware or software that still talks to good old fashioned landlines now.

There are devices like this

Computer Telephony CTI Card - USB TAPI-compatible Voice Modem

[Jan 26, 2020] How to connect my telephone line to PC and answer phone calls using headsets

Jan 26, 2020 | www.quora.com

Update Cancel

a RrJ d sP AsNXT b WyA y xIO pek T YH e gQDS l zTzWC l Fy o lBsG osRgW M Pb o mr b F i qmM l t e Ugyn Switch to Tello for unbeatable prices. Build your own plan with minutes, text & data and pay only for what you use. No contract, no catch. Start Now You dismissed this ad. The feedback you provide will help us show you more relevant content in the future. Undo Answer Wiki 3 Answers Altuğ Gür


Altuğ Gür , Avid Bluetooth user for about two decades Answered Dec 13 2016 · Author has 841 answers and 1.9m answer views

This was a rather interesting thing around the end of 90s but quickly lost traction.

There are still solutions but mostly outdated and compatibility/support is questionable so YMMV.

Avanquest classic phone tools promises to deliver this functionality so you may give it a go.

PhoneTools

So does CallSoft.

Call Soft Advanced Voice/Fax Software for Windows

Price range for both products are about $US30.

However, if you're open to suggestions, I'd recommend small landline extension devices that connect directly to phone. They come with a simple but functional headset with mic. You just need to connect t...

Continue Reading Loading

This was a rather interesting thing around the end of 90s but quickly lost traction.

There are still solutions but mostly outdated and compatibility/support is questionable so YMMV.

Avanquest classic phone tools promises to deliver this functionality so you may give it a go.

PhoneTools

So does CallSoft.

Call Soft Advanced Voice/Fax Software for Windows

Price range for both products are about $US30.

However, if you're open to suggestions, I'd recommend small landline extension devices that connect directly to phone. They come with a simple but functional headset with mic. You just need to connect the small dialpad unit to the handset slot of your phone, plug the headset into the dialpad unit and you're done. This setup is not prone to software crashes, incompatibilities or performance issues yet they allow you to make and answer phone calls easily while leaving your hands free.

Been more than 20 years since I've used one so I'm not sure about the availability.

Hope this helps!

Edit:

Managed to find one!

Amazon.com: Work From Home Office Telephone Call Center Dial Key Pad Phone + Headset Headphone with Mute Volume Control: Electronics 9.2k views · View 1 Upvoter · Answer requested by Chintan Shah Chintan Shah Chintan Shah

[Jan 26, 2020] Connect an Asterisk system to the public switched telephone network

Jan 26, 2020 | www.redhat.com

Learn how to set up Asterisk so your softphones can receive incoming calls from outside and make outgoing calls outside your organization as well.

Posted January 23, 2020 | by Anthony Critelli

Image
"Telephone Pole" by Fried Dough is licensed under CC PDM 1.0
In two previous articles, you learned how to configure two SIP phones and the Asterisk dialplan to enable the phones to call each other. Having two phones that can call each other is great, but most organizations want to connect their phone system to the public switched telephone network (PSTN) to allow for inbound and outbound calling to others outside of the organization. In this article, you will learn some background about how to connect to the PSTN and you will see the Asterisk configuration needed for this connectivity.

Note: I've mentioned it several times throughout this series, but it is especially important for this article to understand how to secure your phone system. Connecting to a telephony provider can open you up to all sorts of issues, such as toll fraud, if you aren't careful about controlling who can connect to your phone system (e.g., via firewall rules). Be sure to read the README-SERIOUSLY.bestpractices.md documentation that comes with the Asterisk source code and understand every piece of configuration that you add to Asterisk.

Connecting to the PSTN

Obtaining a telephone number and connecting your phone system to the PSTN might sound like a difficult task, but it's actually pretty easy. Larger organizations may choose to use a local telecommunications provider or their local Internet company, but there are also a variety of online providers available (e.g., Twilio and VoIP.ms , among many others). I will be using VoIP.ms for the phone numbers in this article.

More Linux resources

No matter who you choose, the process is fairly straightforward. You will buy a phone number (often called a direct inward dial, or DID), and you'll configure your phone system to connect with the provider's phone system via SIP. This setup is often referred to as a SIP trunk . The process of configuring your phone system to work with your chosen provider can vary, so it's always best to consult the provider's documentation or work with their voice engineers if you run into trouble.

Let's take a look at the general best practices for configuring your phone service. These are not comprehensive, but they should provide a base of sound advice when working with your provider:

PJSIP configuration

The first step in configuring PSTN connectivity is to define the SIP configuration necessary for Asterisk to communicate with the IP telephony provider. This information will vary a bit by provider, but many of them provide information about the parameters that you need (VoIP.ms actually provides Asterisk-specific instructions ):

Image

In my case, the configuration in /etc/asterisk/pjsip.conf looks like this:

[voipms]
type=endpoint
transport=transport-udp
context=inbound-calls
disallow=all
allow=ulaw
auth=voipms
outbound_auth=voipms
aors=voipms

[voipms]
type=registration
transport=transport-udp
outbound_auth=voipms
client_uri=sip:redacted VoIP.ms username@newyork1.voip.ms:5060
server_uri=sip:newyork1.voip.ms:5060

[voipms]
type=auth
auth_type=userpass
username=redacted VoIP.ms username
password=redacted VoIP.ms password

[voipms]
type=aor
contact=sip:redacted VoIP.ms username@newyork1.voip.ms

[voipms]
type=identify
endpoint=voipms
match=newyork1.voip.ms

Most of this configuration probably looks familiar , but this configuration does introduce two new PJSIP section types: a registration and an identify . The registration section tells Asterisk to explicitly register with the upstream voice provider's server. The identify section tells Asterisk that SIP traffic coming from newyork1.voip.ms should match the voipms endpoint.

After reloading PJSIP, I can see that my local Asterisk server successfully registered with the provider's SIP infrastructure. Note that issues during this stage of the process are fairly common, and you may need to work with your provider to understand what "they see" so that you can effectively troubleshoot:

asterisk-1*CLI> pjsip show registrations

<Registration/ServerURI..............................> <Auth..........> <Status.......>
==========================================================================================

voipms/sip:newyork1.voip.ms:5060                  voipms            Registered

Objects found: 1
Inbound dialplan configuration

Next, Asterisk has to be told what to do with incoming and outgoing calls. Incoming and outgoing calls in Asterisk aren't fancy, they are just extensions in the dialplan like any other extension. I will discuss incoming calls first. Like any programming language, it's important to understand what your goals are before you start writing code. In my case, I wanted a dialplan that would:

  1. Answer an inbound call from the DID that I purchased from my provider.
  2. Allow the user to enter an extension (one for Alice, two for Bob).
  3. Call the appropriate user once the extension was dialed.

Notice that in the above PJSIP configuration, I am using the inbound-calls context for calls from my SIP provider. Here's what that context looks like in /etc/asterisk/extensions.conf :

[inbound-calls]

exten => 1234567890,1,Answer()
same => n,Playback(hello)
same => n,WaitExten(30)
same => n,Hangup()

exten => 1,1,Answer()
same => n,Dial(PJSIP/alice-softphone)

exten => 2,1,Answer()
same => n,Dial(PJSIP/bob-softphone)

Notice that I replaced my real DID with the fake 1234567890 for privacy reasons. You will want to use your real DID if you are following along. Also, notice that my phone number follows a United States numbering convention (a three-digit area code followed by a seven-digit number).

Let's step through this contents of this configuration together:

  1. When my DID is called, Asterisk matches the 1234567890 extension. It answers the call.
  2. Asterisk then plays a built-in "hello" message. In a real environment, you might want to record your own prompts for Asterisk to use.
  3. Asterisk then calls the WaitExten application with a value of 30. This value tells Asterisk to wait up to 30 seconds for the user to enter an extension.
  4. Assuming the user enters an extension of "1" or "2", the dialplan will jump to that extension. Notice that the "1" extension will call Alice's softphone, and the "2" extension will call Bob's softphone.

Once the above configuration is in place, you can reload the dialplan and place a test call to your PSTN phone number. You should hear Asterisk say "hello," and you should be able to dial one of the extensions and have the phone on the other end ring.

Outbound dialplan configuration

Being able to place inbound calls is great, but most businesses expect outbound calling functionality as well. Luckily, this is fairly easy to configure.

First, recall from the previous article about intra-office calling that outbound calls for Alice and Bob's phones enter the dialplan in the office-phones context. Therefore, we need a way to match all outbound calls in this context and send them to the upstream provider.

Until now, you've seen extensions configured as exact matches. Extension 1001 matches and dials Alice, extension 1002 matches and dials Bob, and the extension for your inbound DID matches and allows the caller to input a selection. It would obviously be impractical to match every single possible outbound number that a user might dial. Thankfully, Asterisk provides a way to perform pattern matching.

To provide outbound calling for American numbers -- e.g., (123) 456-7890 -- my office-phones context looks like this:

[office-phones]

exten => 1001,1,Dial(PJSIP/alice-softphone)

exten => 1002,1,Dial(PJSIP/bob-softphone)

exten => 9000,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()

exten => _XXXXXXXXXX,1,Set(CALLERID(all)="Anthony Critelli <1234567890>")
same => n,Dial(PJSIP/${EXTEN}@voipms)

If you already took a look at the Asterisk wiki's linked pattern matching documentation, this syntax will look familiar. The outbound extension matches _XXXXXXXXXX , which is a fancy way of saying: "Match a sequence of 10 digits." The underscore indicates that this character is the beginning of a pattern match, similar to the use of the forward-slash (/) in many programming languages to indicate the use of a regular expression. Therefore, this extension will match any 10-digit extension that I send to it, such as standard 10-digit US phone numbers. A more complete example would also account for country codes, local calling, and other considerations. That is an exercise left up to the reader.

The first priority in this extension sets the CALLERID to a string of my choosing. You should replace the name and number with your own name and DID. This practice also introduces another concept in the Asterisk dialplan: The use of variables. In the configuration above, both CALLERID and EXTEN are variables that you have available to manipulate.

The second, and final, priority in the extension simply sends the call to the upstream provider via the PJSIP channel driver. This syntax is pretty straightforward, and it looks a lot like the dialplan that you already wrote to allow two phones to call each other.

With this configuration in place, you can reload your dialplan and try placing a test outbound call from Alice or Bob's phone. Assuming that everything went well, your call should succeed.

Wrapping up

If you've stuck with me from the beginning , then you have successfully implemented a basic phone system using the open source Asterisk PBX. You've come a long way. From understanding VoIP and Asterisk basics to installing and configuring Asterisk from scratch, you should now have an idea of how to configure a simple phone system. Minimally, I hope this series has sparked your interest in learning more about telephony and Asterisk.

If you want to continue your VoIP and Asterisk journey, then I recommend that you check out these resources:

Want more on networking and connectivity topics? Check out the Linux networking cheat sheet .

[Apr 11, 2010] Open Source Asterisk 1.8 Aiming for Long-Term Support

www.voipplanet.com

The Asterisk 1.8 LTS release will likely be available in the third quarter of 2010 and will include a number of new features.

"There are a lot of new items planned for 1.8, and some stuff is already done and in the development trunk waiting for the branch to be released," Fleming said. "A lot of the changes may seem like subtle changes but when an end user sees the difference they will be very happy."

One of the new features is a reverse call display function that will indicate who a user is actually talking to.

"So if you call me, I see on my phone your CallerID, and that has always worked. You will now see on your phone, not the extension you dialed, but the CallerID you would have seen if I had called you," Fleming explained.

Fleming added that if the call is transferred, the call display information is also updated to show the caller the CallerID of the person the user has been connected with.

Another key item expected to debut in Asterisk 1.8 is support for the next-generation IPv6 (define) addressing system. IPv6 is set to become increasingly important as the current IPv4 address space nears total depletion in the next few years. Additionally, Asterisk 1.8 will include more ISDN support to better work on European phone systems that support that standard.

[Feb 14, 2010] Asterisk 1.6 Dinosaur or Ostrich… It Really Doesn't Matter

April 16, 2008 | Nerd Vittles

Jonas:

Digium's point of view is a very dangerous one. The thing is that Asterisk is pretty crappy software (pieces mysteriously break than start working again in the next release, it's happened to me a few times) but the third party service and software ecosystem around it are better than anything else.

Digium has to realize this and do anything to keep third party developers and maintainers happy. If not, they won't stand a chance in future competition from big brands above as well as from smaller projects such as freeswitch below.

xxx:

Quick comment: this isn't just a "Digium thing" in the way upgrades work; this is typically how software development goes in all organizations. Major version number changes mean API changes. That's just how the world works. If you couldn't change an API, then you wouldn't be able to grow and expand the feature set in the software, or sometimes even fix bugs, or increase reliability and scalability.

I have not heard about any fixed date or time frame for EOL'ing Asterisk 1.4. Since a lot of people are still running 1.2, I would imagine 1.4 will be with us for a long time yet (certainly more than a year).

The 1.6 branch has come out, is in beta mode, and I'm not sure what all the hubbub is about in third party incompatibilities. All major version upgrades are going to have things change in them that you couldn't otherwise do, and thus third party applications are going to need to keep pace - and it's not like you HAVE to run 1.6 in production (in fact, you shouldn't… it's not even out of beta yet).

In addition, the 1.6 branch is going to use a different release methodology, which is really the main reason a 1.6 beta is even out in the first place. This does not indicate 1.4 is going EOL anytime soon. Digium's Business Edition C.1.x software was only released around January, and I doubt there is any rush to deprecate that piece of work.

You're probably going to have 1.4 and 1.6 in lockstep for quite some time. The difference between 1.4 and 1.6 is quite a bit less than the difference between 1.2 and 1.4. The reason for 1.6 is that since you CAN'T just release software every year and EOL the existing software, then that means you have to wait 2+ years before you can even start using the new features. Some people can't wait that long, so you have two paths available to you now. 1.6 will allow new features to go in at each minor version release (this means 1.6.x, where 'x' is the minor version, and 6 is the major version - this is significant). So now we have two different methodologies.

A branch that only receives bug fixes and security fixes (1.4), and a branch that receives bug fixes, security fixes, and is allowed to implement new features (this follows the same time of release strategy as the Linux kernel - this is not a new concept). Digium has now also started using release candidates before creating a new release (as per the communities request), so you have the ability to test for any bugs that may have been introduced before the full released is put out for public consumption.

If you need to run 1.4, then go ahead, nothing is going to stop you from doing that, and it's not going away anytime soon. If you need the latest and greatest, or there is some new feature you absolutely must run in production, then you can run a 1.6 machine (when it stabilizes and comes out of beta and release candidate status) with just the feature you absolutely need in a stripped down version, or after extensive testing, then you could put it into production.

I personally think Digium is doing the "Right Thing(tm)" here and giving us choice, and isn't that what this is all about?

stavros:

Despite the extra work it creates, I'm with Digium on this. It's often impossible to add flexibility or improve performance whilst maintaining API compatibility. The reason for the majority of API changes is to address short-sighted decisions in the original design; backwards compatibilty enforces perpetuation of the poor choice and a clean break must be made at some point. The re-plumbing work to which Jared refers is long overdue and, as he intimates, is necessary to provide the enterprise-grade platform for which you are all clamouring.

Whilst a simple upgrade tool for syntax in extensions.{conf|ael} might save a few folks a few minutes, I don't think that's where the bulk of this problem lies. We'd all love to have tool to automatically fix all the AGI/AMI code out there, written in PHP, Perl, C, etc, but it's impossible to do algorithmically. That said, I believe it would be possible to add a compatibility shim to PHPAGI, for instance, to allow most if not all existing PHP AGI scripts to run without modification.

The suggestion that Digium are responsible for fixing everyone else's code is simply ludicrous. As Jared explained, many of the devs can't legally touch much of the code that will need to be fixed. Even if they could I doubt they'd want to; fixing code with which you're not familiar is fraught with difficulties. It's even less appealing when you consider that much AGI code is crufty nonsense written by amateurs. The logical conclusion of this argument is that Microsoft must be similarly charged with fixing every third-party application broken by a service pack, and the Linux/glibc folks must cease scheduled development and spend the rest of eternity fixing all the userspace regressions just assigned to them by downstream!

I'm not sure how you reached your conclusion that Digium have their head in the sand based on Jared's response. You had the opportunity to shape the development of the areas of v1.6 which displease you. I'm afraid it was you with your head in the sand, ignorant of all the work happening in public view for all to see, discuss and even influence. If Digium's track-record with Asterisk v1.2 is anything to go by, you've a long time yet before v1.4 will be unmaintained. There's plenty of time to adapt and to test before you need to look at using v1.6 in production.

Please stop criticising the Asterisk devs for doing necessary work. You may not see it, but they do have our best interests in mind. The benefits of a more maintainable, better architected and more consistent Asterisk codebase far outweigh any short-term heartache during the transition.

[WM: There's a significant difference in saying that "Digium [is] responsible for fixing everyone else's code" and saying that "Digium has responsibility for not breaking everyone else's code." If you reread the article, I think you'll find that I suggested the latter. As for a conversion utility saving a few folks a few minutes, I've spent the better part of six months cleaning up the carnage in dozens of applications that was directly caused by the needless syntax obsolescence imposed in Asterisk 1.4. And for what? I provided a good example in the article that broke virtually every dialplan. Suggesting that such changes were necessary to "improve the engine" is pure B.S. Funny you'd mention Microsoft. I wrote a shareware database management system (WAMPUM) in 1985 for DOS that still runs just fine under Windows XP and Vista.

In fact, I regularly hear from folks that still are using it… almost two decades later! Maybe that's the reason Microsoft is still around while Lotus 1-2-3 (that owned 95% of the spreadsheet market at one point) is now just a blip in the history books.

If you recall, Lotus developers came up with the brilliant idea to change much of 1-2-3's spreadsheet syntax. It gave everyone the perfect opportunity to switch to Excel.]

Digium Strengthens VoIP's Ties to Collaboration By Sean Michael Kerner

February 3, 2009 | InternetNews

Open source VoIP vendor Digium is busy working both ends of its business. It's continuing to lead the open source Asterisk VoIP effort into new territory through integration with calendaring and instant messaging. But at the same time, the company is also rolling out its commercial Switchvox 4.0 VoIP IP PBX (define), with new unified communications features for customers.

While Digium plays in both open and closed source, the company's enhancements to Asterix and Switchvox share a common purpose: more closely tying in other services and software commonly in use in the enterprise.

The new platforms come as the latest effort by Digium to capitalize on enterprises' increasing interest in unified communications (UC), which offers to move features like voice telephony, video, messaging and collaboration services onto a single IP-based platform -- which ostensibly helps companies cut costs in the process. A recent studysponsored by Siemens, a UC vendor, reported that 53 percent of large U.S. companies are discussing, pursuing or implementing such installations.

UC has attracted all of the major players in enterprise messaging and VoIP. As for Digium, UC and integration with other enterprise software is becoming a key feature of both Switchvox and Asterisk, for which the company serves as lead commercial sponsor.

Asterisk, an open source VoIP PBX, has been making waves in the market since its 1.0 release in 2004. While the coming weeks are expected to see some incremental new features and bug fixes with the launch of its 1.6.1 version, it's the upcoming 1.8 version that will deliver several really slick features, Asterisk community manager John Todd told InternetNews.com.

One of them is the ability for Asterisk to merge the worlds of instant messaging and VoIP by using XMPP, also known as the Jabber protocol (define), as a mechanism for PBX notification and control.

"Every time I get a call in on my system, Asterisk can send an XMPP message showing caller information and location," Todd explained. "So the instant messaging system serves as alert system for my PBX."

XMPP could potentially used to control the phone system, as well. For example, a user could simply send an XMPP message to tell their voicemail to delete or forward a message.

Asterisk developers are also working on a new form of deep calendar integration. Todd explained that a new Calendaring API (define) will enable Asterisk to read and write event information from common calendar formats, including Microsoft Outlook, CalDEV and iCal.

"You would be able to have Asterisk do dips into you calendar to see if you're busy and be able to interpret that and execute logic, so your calls could be routed differently depending on what your calendar says," Todd said.

Todd added that Asterisk will also have the ability to write into calendars for call history information. With that capability a user could go back into their own calendar and look at all their call history and information for a given day.

In addition to the mainline Asterisk releases, work also continues to push forward on the AsteriskNow product as well. While Asterisk is a standalone open source PBX application, AsteriskNOW is a full software appliance, including a Linux operating system and a graphical user interface (GUI) to control and manage the PBX.

Version 1.5 of AsteriskNOW is currently in beta, and Todd said a final release is expected in the coming weeks. When it debuts, it'll inaugurate a number of changes: The 1.5 release includes a new GUI and is based on the CentOS Red Hat Linux clone, while the 1.0 release had been based on rPath Linux.

Todd added that developers are also working on AsteriskNOW 2.0, which will further extend the features with integrated Skype capabilities. The enhancement would let AsteriskNOW use Skype, the eBay-owned VoIP platform, in the same way it uses a normal phone line as part of its PBX.

[Jan 15, 2009] CounterPath Corporation X-Lite Download

This is pretty slick softphone with an intuitive interface
X-Lite is a fully functioning softphone featuring many of the popular features of eyeBeam. With your existing connection to a VoIP or broadband service or an IP-PBX (e.g. Asterisk, enterprise LAN), it allows you to make calls to any softphone, mobile or landline number.

A subscription with a VoIP service provider or your ISP is required. Please contact the VoIP service provider of your choice to subscribe.

Download X-Lite 3.0 for Windows Download X-Lite 3.0 for Mac Download X-Lite 2.0 for Linux

[Jan 15, 2009] Idefisk - IAX2 softphone

Supports AIX2 instead of SIP. AIX2 uses a single port and is Astrist specific protocol

ZOIPER IAX Softphone | SIP Softphone

Asterisk The Open Source PBX & Telephony Platform

FBI issues warning over VoIP scammers hijacking Asterisk

A guide to VoIP and Asterisk- Page 1

Asterisk@Home Handbook

Pretty detailed manual

Asterisk@Home Handbook

University dumps Cisco VoIP for open-source Asterisk - Network World

Amazon.com Configuration Guide for Asterisk PBX Flavio Goncalves Books

Asterisk Guru - Tutorials and howto's for the asterisk PBX and ...

Comains brif installation for various platforms

XMPP) Basic Setup Tutorial

January 29, 2008

Hi Guys,

I had written this a while ago for Open Source Telephony Magazine, which has now been bought by VON Magazine, but I do not think it was published, so I thought I'd post it here for all to see. This article deals with setting up your Asterisk VOIP PBX to run along side a Jabber XMPP Server to send message alerts, incoming call notifications, queue statistics, basically whatever you can dream up. This article only explains the basics, but if you extend on it, please do post and let me know your thoughts.

Below you'll find links to the article in three formats, Microsoft word 2007, Microsoft word 2003 and Adobe PDF.

ast_xmpp_article.doc

ast_xmpp_article.docx

ast_xmpp_article.pdf

Recommended Links

Index of -asterisk-149

voip-info.org - voip-info.org

Reference

voip-info.org



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2020 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019