DialPlan 開發技巧整理
官方教學:https://wiki.asterisk.org/wiki/display/AST/Dialplan
數學計算
; Syntax: +, -, *, / $[1 + 2]
比較式
; Syntax: =, >, >=, <, <=, != $[${var1} < ${var2}]
多個比較式
; Syntax: &, | $[${var} > 0 & ${var} < 9]
exten => _X.,1,Set(mb=${EXTEN}) exten => _X.,n,Set(x=1) exten => _X.,n,While($["${SIP_HEADER(Diversion,${x})}" != ""]) exten => _X.,n,Set(mb="${SIP_HEADER(Diversion,${x})}") exten => _X.,n,Set(mb=${CUT(mb,@,1):-4}) exten => _X.,n,Set(x=$[${x}+1]) exten => _X.,n,EndWhile() exten=> _X.,n,Goto(from-pstn,${mb},1)