Go Premium for a chance to win a PS4. Enter to Win


Multi User Asterisk Setup, Extensions only No Trunk needed

Posted on 2008-06-15
Medium Priority
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.

[Video] Oticon Case Study

Open office environments can create the dynamics for innovation, but they also bring some challenges. With over 1,000 employees in an open office, Oticon needed a solution that would preserve the environment while mitigating disruptive background noises.

Watch how they did it.


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 1000 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 Malmstead
Ron Malmstead earned 1000 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"

...now 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 files....trust 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 do...you are pretty stuck using the GUI, but some people prefer it.....not me.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

So you think no one can listen in on your VOIP conversations, eh? Well... if you haven't setup Secure Real Time Transport (SRTP), your voice communications can be hacked into by just about anyone! First, let's talk about the intended audience for…
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 …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Screencast - Getting to Know the Pipeline
Suggested Courses

916 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