Multi User Asterisk Setup, Extensions only No Trunk needed

Posted on 2008-06-15
Last Modified: 2013-11-12
I am looking for assistance in setting up a dial plan for my company. We will be using the Asterisk PBX, however I am not familiar with the syntax of the dial plan's that Asterisk use's

This will only be used for the IT department, and will need to have the ability to have assigned extensions..

So for example User1's extension is 5555, anyone can dial 5555 and get to that person. Any help would be greatly appriciated.
Question by:Sam Cohen
  • 3
  • 2
LVL 19

Expert Comment

ID: 21792051
Are you using IP phones/softphones as extensions or have you got conventional analogue extensions connected via a Digium card (or similar card)?

Do you know which context is used when someone dials a number? For example, the [default] context. Contexts are the logical blocks of the dial plan within extensions.conf. Which context is used by each connected device depends on the configuration in the conf file for that device type. For example, the context for SIP phones is defined by settings in sip.conf and the context used by analogue extensions would be defined in zapata.conf. Once you know which context is used by the calling phone, then you just add a dial plan into that context with an extension number or pattern that matches the dialled number. So in its most basic form, assuming your extensions are SIP phones, you could add:
exten => 5555,1,Dial(SIP/5555,25)

If you know that all internal extension numbers are 4 digits long and start with 5 then you could use a pattern match and variable instead like this:
exten => _5XXX,1,Dial(SIP/${EXTEN},25)

Author Comment

by:Sam Cohen
ID: 21794767
The extensions are still being worked on, but more than likely they will be numerical. We will be using soft phones, which will be SIP based.

Based on your example "exten => 5555,1,Dial(SIP/5555,25)" What does this part do I guess you could say. (SIP/5555,25) I understand the first portion which is basicly, user,priority,action, however I am not familiar with the additional information added. If you could explain that part it would be very helpful and would probably give me the understanding I need to progress further. Thank you
LVL 19

Expert Comment

ID: 21795033
"Dial" is the action, but the parameters used by the Dial command are passed in parantheses (similar to calling a subroutine in a programming language). So the Dial command is sent two parameters: the first is the target that it will dial - a SIP extension with number 5555 - and the second is the time it will wait, in seconds, before reporting a NOANSWER result.
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.


Author Comment

by:Sam Cohen
ID: 21795928
Ok, so please correct me if I am wrong, but an example dial plan for a single user would be something like..

exten =>5555,1,Dial(SIP/5555,25)
exten =>5555,1,Answer()
exten =>5555,2,Hangup()

Does that look about right or am I missing info? We will be using Voice Mail also.
LVL 19

Accepted Solution

feptias earned 250 total points
ID: 21800824
Unfortunately, that is not right and it contains an error - you must not have two lines with the same extension number and step number (=>5555,1,..). The Asterisk way of thinking does take a bit of getting used to, especially with respect to the Dial action. I'll try to explain it:

When Asterisk acts as a PBX, it is able to deliver the call without first having to answer it. You would only need Asterisk to answer the call if you wanted Asterisk to interact with the caller - for example, to play a greeting or request some input from the caller. In effect, Asterisk handles all the stuff concerned with the caller's phone going off-hook and the caller dialling a number, without you having to write a single line in the dial plan. So you don't *have* to use the Answer() action anywhere if you just want your Asterisk extensions to be able to call each other. You just need to tell Asterisk where to deliver the call when the caller dials a particular number - that is done using the Dial action. If the called phone (the target of the Dial action) answers, then Asterisk will bridge the two legs of the call together and the calling and called parties can talk to each other. When they hang up, the dial plan will jump to a hangup section (if one exists) or will simply exit - it doesn't go to step 2 after they hangup. So one line of dial plan is enough (I have deliberately changed the target to 5678 to illustrate the point):
exten => 5555,1,Dial(SIP/5678,25)

This means that when the caller dials 5555, they will be connected to SIP extension 5678. That would of course be slightly perverse, so the actual line would be:
exten => 5555,1,Dial(SIP/5555,25)

The next step in the dial plan would only be reached if extension 5555 failed to answer. For example:
exten => 5555,1,Dial(SIP/5555,25)
exten => 5555,2,<next_action>

If you had 200 extensions, it would be very tedious to have to add those lines 200 times into the dial plan, so instead you can use pattern matching and variables. _5XXX is an example of a pattern that would be matched whenever the caller dials a 4 digit number starting with 5. The variable that has the actual number dialled would be ${EXTEN} so the dial plan might look like this:
exten => _5XXX,1,Dial(SIP/${EXTEN},25)
exten => _5XXX,2,<next_action>

I don't use Asterisk voicemail so I'm not qualified to explain how that would be done, but this link might be helpful (interestingly they use step 1 Answer before step 2 Dial, but I am 100% certain that the Dial command will work without the need to use Answer() beforehand):
LVL 25

Assisted Solution

by:Ron M
Ron M earned 250 total points
ID: 21950744
The two main files you will need to edit to get calls working, are SIP.conf and Extensions.conf

This is where you create entries for SIP peers...
example entry...



example dialplan entry for dialing the sip peer.

exten => 5555,1,Dial(SIP/${EXTEN},20)

To add voicemail, you need to edit voicemail.conf file...
and add a line after dial...
exten => 5555,n,VoiceMail(5555@default,u)

[default] is the context, the "n" is the priority, of extension 5555... the above invokes the voicemail app after the dial timeout of 20 seconds...and plays the "unavailable" message ... ",u" after you get basic calling and vm setup you can experiment with different dialplan applications...

just remember this one important thing...

The traversal of calls or channels through the dialplan always goes like this...


If you plan on doing anything beyond basic calling I would suggest getting a book or two on asterisk.

also, backup your conf files before every edit...  you can never have enough backups of these me.

If you want to take the easy road...with the least manual configuration needed... try AsteriskNOW.  Asterisk now is limited however in what you can are pretty stuck using the GUI, but some people prefer it.....not me.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently purchased a Bluetooth headset called the Music Jogger (model BSH10). The control buttons on it look like this: One of my goals is to use it as the microphone and speakers for Skype calls. In that respect, it works well. However, I …
As companies replace their old PBX phone systems with Unified IP Communications, many are finding out that legacy applications such as fax do not work well with VoIP. Fortunately, Cloud Faxing provides a cost-effective alternative that works over an…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now