I have the following pair of macros defined to handle outbound calls from *. Rather than specifying full dialstrings in the main body of extensions.conf, outbound dial commands are made using a macro call as follows: Macro (outbound,number_to_dial,callerid_to_present,gateway1,gateway2,gateway3,gate way4) The final gateway defined is nearly always a fallback to PSTN if none of the IAX or SIP gateways are working. The problem is, its an incredibly unwieldy macro that's horrible to edit if I want to add a new gateway to the thing. Looking through the documentation for macro programming, I couldn't find the equivalent of a 'shift' statement you'd find in other programming languages. Can a kind soul suggest how I might tidy it up? Thanks in advance. [macro-outbound] ; ${ARG1} Number ; ${ARG2} Caller ID ; ${ARG3,4,5,6} Outgoing gateways in order of use exten => s,1,GotoIf($["${ARG2}" = ""]?4) exten => s,2,SetCIDNum(${ARG2}) exten => s,3,Goto(5) exten => s,4,SetCIDNum(${DEFAULTCID}) exten => s,5,SetVar(GATEWAY=${ARG3}) exten => s,6,SetVar(ARG3=${ARG4}) exten => s,7,SetVar(ARG4=${ARG5}) exten => s,8,SetVar(ARG5=${ARG6}) exten => s,9,GotoIf($["${GATEWAY}" = "voip1"]?14) exten => s,10,GotoIf($["${GATEWAY}" = "voip2"]?18) exten => s,11,GotoIf($["${GATEWAY}" = "voip3"]?16) exten => s,12,Macro(dialout,SIP/${ARG1}@pstn) exten => s,13,GotoIf($["${ARG3}" = ""]?20:5) exten => s,14,Macro(dialout,IAX2/voip1/${ARG1}) exten => s,15,GotoIf($["${ARG3}" = ""]?20:5) exten => s,16,Macro(dialout,IAX2/voip2/${ARG1}) exten => s,17,GotoIf($["${ARG3}" = ""]?20:5) exten => s,18,Macro(dialout,SIP/${ARG1}@voip3) exten => s,19,GotoIf($["${ARG3}" = ""]?20:5) exten => s,20,Playtones(congestion) exten => s,21,Congestion() [macro-dialout] ; ${ARG1} Dialstring exten => s,1,Dial(${ARG1},,W) exten => s,2,Goto(s-${DIALSTATUS},1) exten => s-BUSY,1,Playtones(busy) exten => s-BUSY,2,Busy() exten => _s-.,1,NoOp(${DIALSTATUS}) Regards, Chris -- C.M. Bagnall, Director, Minotaur I.T. Limited This email is made from 100% recycled electrons