[asterisk-users] Shortening Context code
Phil Reynolds
phil at tinsleyviaduct.com
Fri Aug 31 04:50:30 CDT 2007
On Fri, Aug 31, 2007 at 10:34:42AM +0100, Adrian Marsh wrote:
> 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?
You could do it as a macro... then all you'd have to do is call the
macro on appropriate extens.
--
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