一个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