[Asterisk-Users] Re: [Asterisk] Major new * Dialplan Features
Martin Pycko
martinp at digium.com
Sat Feb 22 17:39:24 MST 2003
On Sat, 22 Feb 2003 jharragi at mw.k12.ny.us wrote:
>
> I've got to revisit this. My boss wants to be able to be able to deploy
> phones on the fly. We have several networks on which we use dhcp which
> usually consist of a class c block of addresses. It occured to me that the
> extension number could be based on IP address and it might be good to be
> able to do something like this:
>
> exten => _7xxxxx,1,Dial,SIP/BYEXTENSION at 192.168.${EXTEN:1:2}.${EXTEN:3:3}
> exten => _7xxxxx,2,Playback,NotOnLine
You already can do this in two ways:
1) in [globals] you may place ip_740022=192.168.40.022
and then
exten => _7XXXXX,1,Dial,SIP/BYEXTENSION@${ip_${EXTEN}}
or
exten => _7XXXXX,1,Substring,part1=${EXTEN}|1|2
exten => _7XXXXX,2,Substring,part2=${EXTEN}|3|3
exten => _7XXXXX,3,Dial,SIP/BYEXTENSION at 192.168.${part1}.${part2}
we might consider implementing Substing directly in ${EXTEN|a|b} ...
regards
Martin
>
> to match 192.168.40.022 you would dial 740022
>
> ..this might work already. Do the ${EXTEN} variables support bash-like
> substringing? (I have got to get an * box set up at home - but for now I
> wanted to send this while I was thinking about it)
>
> While we were talking about establishing syntax, I would recommend
> abandoning ${EXTEN-1} for ${EXTEN:1} to maintain compatibility with bash
> syntax (so as not to be confused with things like $(($EXTEN-1)) &
> $((${EXTEN:2:2}-24)) which would be good to match ranges of zap
> channels... this might be a long term future thing). Of course this
> suggestion is null if Mark's favorite shell uses the other syntax.
>
> > > [default]
> > > Macro(lesstyping,62[01-24],Zap/$1) ;would handle a
> > > whole channel bank
> >
> > That's an interesting idea. You can, in fact, do something along these
> > lines already though, like this:
> >
> > [default]
> > exten => 62XX,1,Macro(lesstyping,${EXTEN}, Zap/${EXTEN-2})
> >
>
> ..anyway, we could wind up doing things like this...
> [default]
> exten => 62[25-48],1,Macro(lesstyping,${EXTEN}, Zap/$((${EXTEN:2:2}-24))
> ..and trailing digits of longer extens could be passed to remote
> systems...
>
>
>
> John
>
>
>
> -----------------------------------------------------
> This message was sent using Monroe-Woodbury's WebMail.
> http://webmail.mw.k12.ny.us/
>
>
> This e-mail was scanned and found clean by Monroe-Woodbury CSD Antivirus.
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
More information about the asterisk-users
mailing list