[Asterisk-Users] Extension and phone management bestpractices??
Siggi Langauf
langausd at swt.uni-stuttgart.de
Thu Aug 14 05:55:49 MST 2003
On Wed, 13 Aug 2003, Devon Henderson wrote:
[...]
> > > We have agents who work both from home and from the office.
> > Some agents are
> > > always in the office, some are always at home, and some
> > alternate between
> > > the two.
[...]
> I guess my big question is: is it possible to have extensions mapped to
> people, not to phones?
Sure, as mentioned by others, you'll just have to map user extensions to
phone lines when users are logged in.
I'd strongly recommend assigning numbers to to individual phones, too.
(Sometimes you want to call "room No. 123, no matter who's logged in
there", eg if the PC in there suddenly stops responding and you want
somebody to look after that...) Those location based extensions would be
independent from the technology used, so you could exchange MGCP, SIP or
analog phones by just reassigning the phone number to a new channel.
That said, you can quite nicely map user extensions to location extensions
using *'s extension logic and the database application. Let's assume your
inhouse policy says:
Extensions 5XYZ refer to Phone No. Z in room No. Y on Floor X,
Extensions 6XXX refer to user no. XXX.
You would then start by conventionally mapping your phone lines to the
5XYZ extensions in extensions.conf (and the appropriate channel
configuration files).
Next step is adding your users to *'s database, assigning them a password,
eg:
CLI> database add password 001 123
CLI> database add password 002 456
(That assigns user 001 the password "123", whereas user 002 gets "456".)
Now you can add quite simple extension logic for all users in your
database, eg. like this (extensions.conf, again):
exten = _6XXX,1,DBGet(TARGET=location/${EXTEN:1})
;user location was found in DB, go there (assuming _5XXX in "default")
exten = _6XXX,2,Goto(default,${TARGET},1)
;DBGet failed, so user is not logged in. => give VoiceMail
exten = _6XXX,102,Voicemail2(u${EXTEN})
You'll probably want to set outgoing caller ID to the user's extension
instead of the location-based one. That's easy, too:
Put all the phones into a special context that has this:
exten = s,1,DBGet(USER=UID/${EXTEN:1})
exten = s,2,SetCallerID(6${USER})
exten = s,3,Goto(default,s,1)
Finally, you'll need some way for users to register. That could be a web
form that checks the user-provided password (using DBget, maybe via
asterisk -rx "database get password XXX"), and puts the given location
into the database (using DBput, maybe via
asterisk -rx "database put location XXX 5XYZ")
The same script must set the reverse mapping, too, using DBput or like:
asterisk -rx "database put user 5XYZ XXX"
You could also do that via extension logic, eg let people just dial
7XXX to log in, using something like this:
(note that I leave the password check as an exercise to the reader ;-)
; login user if they come from a location (5XXX) extension
exten = _7XXX/_5XXX,1,DBput(location/${EXTEN:1}=${CALLERIDNUM})
exten = _7XXX/_5XXX,2,DBput(user/${CALLERIDNUM}=${EXTEN:1})
exten = _7XXX/_5XXX,3,Playback(login-succcessfull)
exten = _7XXX/_5XXX,4,VoiceMailMain(s6${EXTEN:1})
And to logout, just have people dial 7000:
exten = 7000/_6XXX,1,DBget(LOCATION=location/${CALLERIDNUM:1})
exten = 7000/_6XXX,2,DBdel(user/${LOCATION})
exten = 7000/_6XXX,1,DBdel(location/${CALLERIDNUM:1})
exten = 7000/_6XXX,2,Playback(user)
exten = 7000/_6XXX,3,SayDigits(${CALLERIDNUM:1})
exten = 7000/_6XXX,4,Playback(logged-out)
Phew!
That has become more that I had expected. Anyhow: You should get the idea
that it's possible (and quite useful) to have _both_ locations and users
assigned to constant extensions using Asterisk, and you can do the login
via both a web form (CGI, PHP, whatever) or directly by having people dial
"magic" extensions.
Cheers,
Siggi
More information about the asterisk-users
mailing list