一個dialplan可以同時用於in和out,in放前麵,out放後麵

來源: 2011-08-03 22:41:36 [博客] [舊帖] [給我悄悄話] 本文已被閱讀:

以下是最最典型和精簡的,大多數人不需要做打入的處理,可以略去。

#incoming call processing

#based on caller (CID)

case req.Header.From.FromURI.User

when /^1234567890/ then

sys.Dial("username@local")

sys.Respond(480, "#{sys.Username} Not available")

end

#based on callee

case req.URI.User

when /username/ then

sys.Dial("username@local")

sys.Respond(480, "#{sys.Username} Not available")

end

 

#outbound call processing

case req.URI.User

when /^1?\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d$/ then

sys.Google...

sys.Respond(480, "#{sys.Username} Not available")

when /^\\+\\d{3,}/,/^00\\d{3,}/,/^011\\d{3,}/ then

sys.Dial("VoipDiscount")

sys.Respond(480, "#{sys.Username} Not available")

else

sys.Respond(480, "#{sys.Username} Not available")

end