[asterisk-users] Shortening Context code

Adrian Marsh Adrian.Marsh at ubiquisys.com
Fri Aug 31 04:34:42 CDT 2007


Hi All,

If I had a large block of code, eg:

[outgoing-pstn-gradwell]
; the caller ID convertion assumes that the last two digits of the
callers id 
; are mapped to the last two digits of the PSTN number.
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)

(or larger)

But I wanted to use the same logic for a different EXTEN,  eg (_**777),
instead of duplicating the entire code, would there be a way to re-use
the same block without copy/paste?

Adrian



More information about the asterisk-users mailing list