[Asterisk-Users] Re: [Asterisk] Major new * Dialplan Features

jharragi at mw.k12.ny.us jharragi at mw.k12.ny.us
Fri Feb 21 20:13:29 MST 2003


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

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.




More information about the asterisk-users mailing list