你可以考虑下面的code,其实ckleea多年前提供的superdial,怎样在Asterisk-GUI实现,那么要看看ckleea以前写过的帖子。
[macro-superdial]
exten => s,1,Set(GROUP()=${ARG5})
exten => s,2,Set(GROUPCOUNT=${GROUP_COUNT(${ARG5})})
exten => s,3,GotoIf($[${GROUPCOUNT} > ${ARG6}]?104)
exten => s,4,GotoIf($["${ARG7}" = ""]?macro-superdial,s,6)
exten => s,5,Set(CALLERID(name)=${ARG7}) ; skip this if ARG7 is empty
exten => s,6,GotoIf($["${ARG8}" = ""]?macro-superdial,s,8)
exten => s,7,Set(CALLERID(number)=${ARG8}) ; skip this if ARG8 is empty
exten => s,8,GotoIf($["${ARG9}" = ""]?macro-superdial,s,10)
exten => s,9,SetAccount(${ARG9}) ; skip this if ARG9 is empty
exten => s,10,Dial(${ARG1},${ARG2},${ARG3},${ARG4})
exten => s,11,Goto(s-${DIALSTATUS},1)
exten => s,104,Goto(s-CHANUNAVAIL,1)
exten => s-BUSY,1,Noop
exten => s-NOANSWER,1,GotoIf($["${ARG10}" = ""]?macro-superdial,s-NOANSWER,3)
exten => s-NOANSWER,2,Voicemail(${ARG10})
exten => s-NOANSWER,3,Noop
exten => _s-.,1,Noop
[trunk-superdial-china-0a]
exten => _0.,1,Macro(superdial,SIP/trunk-1/008886${EXTEN:1}#)
exten => _0.,n,Macro(superdial,SIP/trunk-2/008886${EXTEN:1}#)
exten => _0.,n,Hangup() |