[asterisk-users] Shortening Context code

Phil Reynolds phil at tinsleyviaduct.com
Fri Aug 31 08:45:13 CDT 2007


On Fri, Aug 31, 2007 at 02:17:57PM +0100, Adrian Marsh wrote:
> 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 ?

You ALWAYS use the extension "s" in a macro.

[macro_test]
exten => s,1,ExecIF($["${RECORDOUTBOUND}"="TRUE"],Monitor,wav|${TIMESTAMP}-${CALLERID(num)}-${MACRO_EXTEN}-${UNIQUEID}.WAV)
exten => s,n,ExecIF($[${LEN(${CALLERID(num)})}=4],Set,CALLERID(number)=${PSTN_GLOBAL}${CALLERID(num):-2})
exten => s,n(dial),Dial(${TRUNK}/${MACRO_EXTEN},,W)
exten => s,n,Congestion
exten => s,n,Goto(outgoing-zen-out-0,${MACRO_EXTEN},1)
exten => s,dial+101,Busy
exten => s,n,Goto(outgoing-zen-out-0,${MACRO_EXTEN},1)

Now, if you make, in the context you want the extensions in, these:

exten => _0.,1,Macro(test)
exten => _**777.,1,Macro(test)

... it will achieve what you want - MACRO_EXTEN will contain the actual
matched number.

-- 
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