我用的是英國的sipgate號碼,因為我沒有申請到美國的sipgate號碼。用美國的DID應該更好,因為用英國的前麵要撥0044,讓電話號碼顯得很長。 我在sipsorcery的trace裏麵查了,下麵dial plan中打印出的號碼沒有00但有86,是這樣:86xx...x。下麵的dial plan是在sipsorcery的subaccount裏麵設置的,個別語句和main account裏的不一樣:
# Ruby
sys.Trace = true
if sys.In then
sys.Log("hello world")
case req.Header.From.FromURI.User
when /^00/
callercid="#{req.Header.From.FromURI.User.to_str[2..-1]}"
sys.Log("cid #{callercid}")
else
callercid = req.Header.From.FromURI.User
end
sys.Log("cid #{callercid}")
case callercid
when /^86/ then nb = "011"
when /^01186/ then nb = ""
else
nb = "01186"
end
sys.Log("cid #{callercid}")
sys.Callback("#{nb}#{callercid}@nonoh","389xxxxx@abcdevoip.getmyip.com:5060",15)
end