[asterisk-users] Shortening Context code

Phil Reynolds phil at tinsleyviaduct.com
Fri Aug 31 06:12:45 CDT 2007


On Fri, Aug 31, 2007 at 11:39:01AM +0100, Adrian Marsh wrote:
> I'm not sure if a macro would work, as it's the exten => _0 bit that
> we'd be looking at:
> 
> [macro_test}
> Exten =>
> _0.,1,ExecIF($["${RECORDOUTBOUND}"="TRUE"],Monitor,wav|${TIMESTAMP}-${CA
> LLERID(num)}-${EXTEN}-${UNIQUEID}.WAV)
> exten =>
> _0.,2,ExecIF($[${LEN(${CALLERID(num)})}=4],Set,CALLERID(number)=${PSTN_G
> LOBAL}${CALLERID(num):-2})
> exten => _0.,3,Dial(${TRUNK}/${EXTEN},,W) exten => _0.,4,Congestion
> exten => _0.,5,Goto(outgoing-zen-out-0,${EXTEN},1)
> exten => _0.,103,Busy
> exten => _0.,104,Goto(outgoing-zen-out-0,${EXTEN},1)
> 
> to also work like:
> 
> Exten =>
> _**777.,1,ExecIF($["${RECORDOUTBOUND}"="TRUE"],Monitor,wav|${TIMESTAMP}-
> ${CA
> LLERID(num)}-${EXTEN}-${UNIQUEID}.WAV)
> exten =>
> _**777.,2,ExecIF($[${LEN(${CALLERID(num)})}=4],Set,CALLERID(number)=${PS
> TN_G
> LOBAL}${CALLERID(num):-2})
> exten => _**777.,3,Dial(${TRUNK}/${EXTEN},,W) exten => _0.,4,Congestion
> exten => _**777.,5,Goto(outgoing-zen-out-0,${EXTEN},1)
> exten => _**777.,103,Busy
> exten => _**777.,104,Goto(outgoing-zen-out-0,${EXTEN},1)
> 
> So I can't see how a macro would work as I can't use variables in the
> "exten => " part..

You use the "s" exten in macros... and reference the exten it was called
from as ${MACRO_EXTEN}.

-- 
Phil Reynolds
 o  ____ mail: phil at tinsleyviaduct.com
|L_ \  / Web: http://www.tinsleyviaduct.com/phil/
(_)- \/  Waltham 66, Emley Moor 69, Droitwich 79, Windows 95



More information about the asterisk-users mailing list