Why not just use
numbers?
I may have to, but I
read that Asterisk would support alphanumeric SIP/IAX extensions and got all
inspired. This started from a desire to run multiple SIP clients, but
using different logins to get around issues with "last registration wins"
ringing behavior and the like. Think of it as seperating the concepts of
"users"from "devices". The other thing contributing to the design is
the need to have a multi-tenant PBX(with some of the users existing in
more than one of the tenants) and have numeric extension lists be local to each
tenant. That is, company A could have extension 1000 be Dave, while
company B's extension 1000 goes to Bill. Similarly, user "dave" might be
extension 1000 at one company and 1011 at another.
I have three SIP
devices: dave, dave-laptop, and dave-cisco. Each one has a "mailbox=dave"
entry, so I don't end up with three voicemail boxes, and I use that mailbox
setting elsewhere to determine what the "main" SIP device is for a particular
user. The convention I established was that I'd use the person's Active
Directory user id as the first one, and add a hyphen and a descriptor for any
add'l devices.
Thecompany in
this example is "deskoptional", so there is a context in my dialplan like
this:
; Extension
map for deskoptional[deskoptional]exten =
1000,1,Goto(switchboard,dave,1)exten =
1001,1,Goto(switchboard,andrea,1); and so on...
The switchboard
context is used by alltenants to direct traffic to the approprate SIP/IAX
device(s). Note the "dave" one rings all my devices.
[switchboard]exten
=
dave,1,Macro(stdexten,${EXTEN},SIP/daveSIP/dave-laptopSIP/dave-cisco)exten
= andrea,1,Macro(stdexten,${EXTEN},SIP/andrea)
I decided to make
the voicemail extension be 1, so there's an entry in the appropriate place to
extract the SIP name andtruncate it at the first hyphen, so that dave,
dave-laptop, and dave-cisco all get passed as "dave". That's not strictly
necesary, I guess, since all three of them point to the same mailbox
anyway. But it illustrates the technique well.
exten =
1,1,Set(target=${CHANNEL:4}-)exten =
1,n,Set(target=${CUT(target,,1)})exten =
1,n,VoiceMailMain(${target})
Similarly, I wanted
to handle alphanumeric dialing from softphones. I got around Asterisk's
lack of alphabetic extension matching by using an included subcontext.
This takes a dialed extension like "dave-laptop" and gets the mailbox id from
sip.conf, then calls switchboard with that. Since it's "dave" in all three
cases, this prevents the scenario of me calling somebody from my laptop and
having them try to call me back after I've finished my Americano and gone back
to my desk. A call to any one of my SIP devices will always go to all of
them.
[local-sub];
This has to be in a sub-context to prevent the wildcard from matching when we
don't want; it to. This is because Asterisk doesn't handle alphabetic
characters in extension matching,; but we need a way to handle calls dialed
as alpha.exten = _., 1,Set(target=${SIPPEER(${EXTEN}:mailbox)})exten
= _., 2,NoOp(Target is ${target})exten = _.,
3,Goto(switchboard,${target},1)
All this works
surprisingly well, but for the wee little problem of the VoiceMail
applicationgetting mixed up byalphanumeric extensions that start
with the same letter as one of its flags (s/u/b). It occurs to me that I
could sidestep this and perhaps future problems with alphanumeric by using the
same overall structure, but come up with a numeric representation for the
userids. It'd certainly be a lot easier to just use the names, though, and
since Asterisk at least purportedly supports alphaumeric extensions I'm hoping
this problem is solvable.
All I need is a way
to uppercase a string, which from everything I've read so far isn't in the
code. Then again, I could just use all uppercase for my SIP/IAX device
names even if it *does* look ugly. ;)
___
--Bandwidth and Colocation provided by Easynews.com --
Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users