IP04 Adventures - Day 5
In my last entry ("Thoughts on a home PBX", I mused on how my exploration of the IP04 had bogged down because I didn't have a good plan for how I wanted to use it. Well, that's cleared up now.
As I suggested in that entry, I've decided to use the three FXS ports to connect each of the three floors of my house, and the FXO port to connect to the PSTN. So, I've now got a rudimentary dialplan set up that manages each line. Later, if I expand my hardware the way I think I might, I can add another IP04 to handle the four Bedroom lines, and change the physical and logical configuration of this IP04 to handle the other three inside lines.
From the PSTN, my extensions.conf dialplan (for the moment) rings all the phones on all three of the inside lines. If no one answers, it plays back a "no one is available" message and hangs up. OTOH, if all the lines are busy, it plays a "all lines are busy" message and, again, hangs up.
- This "incoming" plan looks like
;---------------------- From PSTN -------------------------
[incoming]
comment = Handle calls coming in from the PSTN
exten = s,1,Answer()
exten = s,2,Dial(${Mainfloor}&${Basement}&${Bedrooms},5,r)
exten = s,3,Zapateller()
exten = s,4,Playback(vm-nobodyavail)
exten = s,5,Hangup
exten = s,103,Playback(tt-allbusy)
exten = s,104,Congestion()
exten = s,105,Hangup
Yes, it's crude. But for the moment, it does what I want. Later, I'll improve it to be less rude, and give the caller an option to leave a message. I'll also add in time rules so that calls at the dinner hour go straight to voicemail, and calls without a callerid (or with a suspicious callerid) will just get hung up.
From the inside, I've deviated a bit from the usual Asterisk setup; you don't dial 9 to get an outside line. This is part of what slowed me down; all the examples I saw had the typical, intrusive "dial 9 first" configuration, and I wanted my dialplans to be transparent. So, I had to eliminate the 9, and make sure that my internal extensions did not conflict with anything that could be dialled.
I made some policy decisions: only the main floor phones could be used for long distance and international calls; the bedrooms and basement phones could only make internal calls and "local" external calls.
- This gave me a set of contexts that look like:
;--------------------- From Inside -----------------------
[MainFloor]
comment = Main Floor phones are permitted any calls
include = numberplan-international
[Basement]
comment = Basement phones are permitted local calls only
include = numberplan-local
[Bedrooms]
comment = Bedroom phones are permitted local calls only
include = numberplan-local
;-----------------------------------------------------------
[numberplan-international]
include = numberplan-longdistance
comment = International
exten = _011.,1,Macro(trunkdial,${Pstn}/${EXTEN})
[numberplan-longdistance]
include = numberplan-local
comment = Long Distance
exten = _1NXXNXXXXXX,1,Macro(trunkdial,${Pstn}/${EXTEN})
[numberplan-local]
comment = Local Calling to 519 & 226 AreaCodes
include = numberplan-assistance
include = default
exten = _519XXXXXXX,1,Macro(trunkdial,${Pstn}/${EXTEN})
exten = _226XXXXXXX,1,Macro(trunkdial,${Pstn}/${EXTEN})
[numberplan-assistance]
comment = Phone company "Assistance" numbers (0/411/611/911)
exten = 0,1,Dial(${Pstn}/0}
exten = 411,1,Dial(${Pstn}/411)
exten = 611,1,Dial(${Pstn}/611)
exten = 911,1,Dial(${Pstn}/911)
;-----------------------------------------------------------
[default]
comment = All internal extensions
include = features
exten = s,1,NoOp(Default)
exten = 700,1,Dial(${Basement})
exten = 710,1,Dial(${Mainfloor})
exten = 720,1,Dial(${Bedrooms})
[features]
comment = Asterisk PBX features
; 750 - Call Park
; 751 - 759 - Parked Calls
; 760 - VoiceMail Pickup
include = parkedcalls
exten = 760,1,VoiceMailMain
Yes, in our area, we use 10-digit dialling. This made the "numberplan-local" context fairly easy to craft, and gave me some boundaries as to which values I could use for the extension phone numbers and Asterisk features.
Of course, to top this all off, I had to make corresponding changes to three other files: users.conf, features.conf, and zapata.conf.
I completely gutted users.conf, removing all user definitions. At the moment, I don't need or want users, and this configuration file overrides values in the other config files. So, out it went.
- For features.conf, I changed the values used in the Call Parking facility. I reserved extensions 750 - 759 for Call Parking, by changing the parkext and parkpos variables
parkext => 750 ; What ext. to dial to park
parkpos => 751-759 ; What extensions to park calls on
- Finally, I altered my zapata.conf to give each line it's own context:
; Channel 1: FXO connected to external phone line
context=incoming
signalling = fxs_ks
channel => 1
; Channel 2: FXS connected to Basement extension phones
context=Basement
signalling = fxo_ks
channel => 2
; Channel 3: FXS connected to Main Floor extension phones
context=MainFloor
signalling = fxo_ks
channel => 3
; Channel 4: FXS connected to Bedroom extension phones
context=Bedrooms
signalling = fxo_ks
channel => 4
And, with all that, I've got transparent (but controlled) dial-out on my extension phones.
Next stop, voicemail.
Comments
I wanted to use the Octothorpe
Since the idea was to make the IP04 look like it was already an "outside" line, I wanted to configure the "internal" extensions so that they didn't conflict with real phone numbers.
My first idea was to prefix all the "internal" numbers with an octothorpe ('#'), so that (for instance) you would dial #720 for the Bedroom extensions.
But, alas, this was not to be.
Asterisk doesn't handle the octothorpe the same way it handles the digit keys, and I couldn't just define my extensions using it. Instead, I had to use an regex to intercept it, and branch to a different context when octothorpe was pressed.
I couldn't make that work, for some reason. It just didn't like the octothorpe as the first digit of a dialled extension.
So, I fell back to my plan B; I made all the extensions numbers that didn't conflict with any outside number that could legally be dialed.