[asterisk-users] Shortening Context code

Adrian Marsh Adrian.Marsh at ubiquisys.com
Fri Aug 31 08:17:57 CDT 2007


Could you give me a short example?  I've always been confused on the usage
of "s".. How would you pass _0 or _**777 to it ?


Adrian Marsh

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Phil Reynolds
Sent: 31 August 2007 12:13
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Shortening Context code

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

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3659 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070831/d66e54e9/attachment-0001.bin 


More information about the asterisk-users mailing list