On Tuesday 01 August 2006 23:43, Thomas Keats wrote:
> So if I ignored ALL the other files, with the exception of these three,
> I could get my system working?
Unless something odd is in one of the files... yes. A default system with
those files modified to match your particular installation should work.
> Done, had a buddy call me and NOTHING registered in CLI, absolutely
> nothing.
?? Every time you pick up a Zap line or a SIP phone registers or any kind of
call attempt is made should generate a message.
Do you see a "*CLI>" prompt?
> Thats what I thought, then its something for me to bang my head over
> later if I get really bored ;)
It's useful for paging, music-on-hold, etc.
> Question, does the dialing plan need to specified per user, or is it
> global/system wide rules that get setup?
The dialplan is both; think of the dialplan as a gigantic, indexed look-up
table. sip/iax/zapata.conf specify contexts for every user, peer and line,
as well as a default context for any user or peer that does not have one
explicitly set. These contexts are the "starting points" in the dialplan for
that particular user/peer/line.
Ok, now that you're confused: look at this example dialplan:
======================
[trunklocal]
exten => _NXXXXXX,1,Dial(Zap/g1/${EXTEN},,g)
exten => _NXXXXXX,n,Macro(handle-hangup)
[trunkld]
exten => _NXXNXXXXXX,1,Dial(Zap/g1/1${EXTEN},,g)
exten => _NXXNXXXXXX,n,Macro(handle-hangup)
exten => _1NXXNXXXXXX,n,Goto(${EXTEN:1})
[trunktollfree]
exten => _800NXXXXXX,1,Goto(trunkld,${EXTEN},1)
exten => _866NXXXXXX,1,Goto(trunkld,${EXTEN},1)
exten => _877NXXXXXX,1,Goto(trunkld,${EXTEN},1)
exten => _888NXXXXXX,1,Goto(trunkld,${EXTEN},1)
exten => _1800NXXXXXX,1,Goto(${EXTEN:1})
exten => _1866NXXXXXX,1,Goto(${EXTEN:1})
exten => _1877NXXXXXX,1,Goto(${EXTEN:1})
exten => _1888NXXXXXX,1,Goto(${EXTEN:1})
[nine11]
exten => 911,1,Playback(about-to-dial-911)
exten => 911,n,Wait(5)
exten => 911,n,Dial(Zap/g1/911,,g)
exten => 911,n,Macro(handle-hangup)
exten => 9911,1,Goto(911,1)
[internal]
exten => _2XX,2,Set(VMMSGTYPE=b)
exten => _2XX,n,Dial(SIP/${EXTEN},20,g)
exten => _2XX,n,GotoIf($[ "${DIALSTATUS}" = "BUSY" ]?busy)
exten => _2XX,n,Set(VMMSGTYPE=u)
exten => _2XX,n(busy),VoiceMail(${EXTEN},${VMMSGTYPE})
exten => _2XX,n,Hangup
[specialstuff]
exten => 6664867,1,ZapScan(1)
[telco-incoming]
exten => s,1,Goto(internal,200,1)
[freeonly]
include => trunktollfree
include => trunklocal
[trusted]
include => specialstuff
include => freeonly
include => trunkld
[office]
include => nine11
include => internal
include => trusted
[office-badboy]
include => nine11
include => internal
include => freeonly
======================
(ok it got a little more complex than I'd intended)
With this zapata.conf:
======================
context = telco-incoming
group=1
channels => 1-3
context = freeonly
group=2
channels => 4
======================
And this sip.conf
======================
context = office
[200]
host=dynamic
type=friend
secret=foo
[201]
host=dynamic
type=friend
secret=foo
[202]
host=dynamic
type=friend
secret=foo
[203]
host=dynamic
type=friend
secret=foo
[204]
host=dynamic
type=friend
secret=foo
context=office-badboy
======================
You start to see how things are pieced together. The first 3 Zap channels are
FXO ports which are connected to telephone lines from the telco. When a call
comes into any one of those lines, they start out in the 'telco-incoming'
context, since that is what is specified. Since they're regular old POTS
lines, you don't get to see what number they dialed to get to you, so they
start out in the 's' (start) extension, which merely jumps to extension 200
in the 'office' context.
Essentially anyone who calls on any of those three lines gets through to
extension 200.
Zap/4 is an FXS interface connected to a courtesy phone in the lobby. If you
dial a number there, you start out in the 'freeonly' context of the dialplan,
which as you can see only allows the person to call local 7 digit numbers and
tollfree numbers.
In sip.conf we have a number of office phones. SIP users "200" through "203"
do not have a context explicitly given, so they inherit the "office" context
through the global sip.conf configuration file options. The office dialplan
context allows you to dial pretty much everywhere, including other office
extensions.
(the _2XX extension logic is a quick-and-dirty implemention of an extension
with voicemail. Look for Eric Wieling (ManxPower)'s incredible standard
extension macros if you really want to give your Asterisk system a powerful
extension system.)
SIP user "204" has a more restrictive dialplan. This person can call other
office extensions and local/tollfree numbers, but not long distance.
As I hope this example shows, the dialplan is global in the sense that there
is only one dialplan for an Asterisk system, but it has many "points of
entry" and you can group together these simple contexts and build very
powerful and very complex dialplans from them.
Please note that this was all from memory... the GotoIfs in particular may be
wrong... Don't waste too much time trying to figure out what you did wrong if
you copy and paste this into your dialplan and it doesn't work. :-)
-A.