如果要限制 Incoming Calls 的最大通話數,一般可以在 sip.conf 加上 call-limit=xx 做到,不過這有幾個缺點:
以 DP 來取代 call-limit 的功能。
編輯 /etc/asterisk/extensions_custom.conf
; Below is used to limit the maximum number of incoming calls for trunk ccnet ; [my-from-trunk-call_limit-ccnet] exten => _.,1,Set(DIAL_TRUNK=2) ;2 is trunk# for ccnet, you can get it on FreePBX exten => _.,n,Set(GROUP()=OUT_${DIAL_TRUNK}) exten => _.,n,Noop(Calls usage(activated): ${GROUP_COUNT(OUT_${DIAL_TRUNK})}) exten => _.,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax) exten => _.,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull) exten => _.,n(nomax),Noop(Passing the call to from-trunk) exten => _.,n,Goto(from-trunk,${EXTEN},1) exten => _.,n(chanfull),Noop(max channels used up) exten => _.,n,Hangup(42) ;42 is causecode, which will return 503 response code exten => h,1,Hangup