瑪凱是國內一家 VOIP Provider,提供 SIP 網路電話服務,不過使用戶在每次撥出時都必須強迫先聽一段語音 "您還可使用xxx分鐘",這樣的設計實在太惱人,比較 make sense 的作法應該是,設計一個特殊碼的撥號,由使用戶主動來查詢自己的通話時間,更人性化的作法,可以在加上"低量通知"功能,由使用戶來設定想要的低量警示值,當低於 xx 通話時間時,系統以 Email 或簡訊通知使用戶。
既然供應商不願意修改系統,只好自己來作,還好在 Asterisk 上可以有很彈性的作法。從 IPBB 的說法,可以在撥號後再按下 # 鍵就可以略過語音提示,基於這樣的流程,我們就使系統在撥出至 IPBB Trunk 時就自動送一個 # 的 DTMF signal,來模擬手按的動作。
作法如下,《PBX》《Tools》《File Editor》搜尋 extension《Filter》選擇 extensions_custom.conf
在 [from-internal-custom] 這段的最下方加上
include => custom-trunk-out-ipbb ; Cancel the ipbb's prompted voice, should dial *333+phone number
在所有內容的最底部,加上下方所有內容
;;;;;;;;;;;;;;;;;;;;;;;;;; start-ipbb trunk out ;;;;;;;;;;;;;;;;;;;;;;;;;; ; prefix code is *333 ; [custom-trunk-out-ipbb] exten => _*333.,1,Macro(dialout-trunk-dtmf-ipbb,2,${EXTEN:4},,) exten => _*333.,n,SendDTMF(#) exten => _*333.,n,Macro(outisbusy,) [macro-dialout-trunk-dtmf-ipbb] include => macro-dialout-trunk-custom exten => s,1,Set(DIAL_TRUNK=${ARG1}) exten => s,n,ExecIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]],Authenticate,${ARG3}) exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1) exten => s,n,Set(DIAL_NUMBER=${ARG2}) exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS}) exten => s,n,Set(GROUP()=OUT_${DIAL_TRUNK}) exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax) exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull) exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid) exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS}) exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK}) exten => s,n(skipoutcid),AGI(fixlocalprefix) exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)}) exten => s,n,GotoIf($[$["${MOHCLASS}" = "default"] | $["foo${MOHCLASS}" = "foo"]]?gocall) exten => s,n,Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}) exten => s,n(gocall),Macro(dialout-trunk-predial-hook,) exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = "BYPASS"]?bypass,1) exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk) exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},1,M(play-outnum-dtmf)) exten => s,n,Goto(s-${DIALSTATUS},1) exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)}) exten => s,n,Set(the_num=${CUT(OUT_${DIAL_TRUNK},$,2)}) exten => s,n,Set(post_num=${CUT(OUT_${DIAL_TRUNK},$,3)}) exten => s,n,GotoIf($["${the_num}" = "OUTNUM"]?outnum:skipoutnum) exten => s,n(outnum),Set(the_num=${OUTNUM}) exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS}) exten => s,n,Goto(s-${DIALSTATUS},1) exten => s,n(chanfull),Noop(max channels used up) exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up) exten => s-BUSY,n,Playtones(busy) exten => s-BUSY,n,Busy(20) exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up) exten => s-NOANSWER,n,Playtones(congestion) exten => s-NOANSWER,n,Congestion(20) exten => s-CANCEL,1,Noop(Dial failed due to trunk reporting CANCEL - giving up) exten => s-CANCEL,n,Playtones(congestion) exten => s-CANCEL,n,Congestion(20) exten => _s-.,1,GotoIf($["x${OUTFAIL_${ARG1}}" = "x"]?noreport) exten => _s-.,n,AGI(${OUTFAIL_${ARG1}}) exten => _s-.,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks) exten => disabletrunk,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} DISABLED - falling through to next trunk) exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook) exten => h,1,Macro(hangupcall,) ; end of [macro-dialout-trunk] [macro-play-outnum-dtmf] exten => s,1,Wait(1) exten => s,2,SendDTMF(#) ;;;;;;;;;;;;;;;;;;;;;;;;;; end-ipbb trunk out ;;;;;;;;;;;;;;;;;;;;;;;;;;
註:請依你的環境修改第5行
exten => _*333.,1,Macro(dialout-trunk-dtmf-ipbb,2,${EXTEN:4},,)
紅字的數字2 改成實際的 IPBB Trunk 編號
藍字的部份*333 是撥號的前置碼,如不修改時,撥號方法需為 *333 + 電話號碼; 如撥號時不想要有任何前置碼,可以改為 X.,並且確定 Outbound Route 的撥號規則無衝突情況。
儲存以上修改,但此時這些修改並不會被系統套用,必須執行 CLI 指令 重新載入 Extension 設定,作法如下:
《PBX》《Tools》《Asterisk Cli》輸入 dialplan reload 《Execute》
完成。
留言列表