• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

Multi User Asterisk Setup, Extensions only No Trunk needed

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.
Sam Cohen
Sam Cohen
  • 3
  • 2
2 Solutions
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)
Sam CohenConsultant to Digital/DeveloperAuthor Commented:
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
"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.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Sam CohenConsultant to Digital/DeveloperAuthor Commented:
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.
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):
Ron MalmsteadInformation Services ManagerCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now