dial plan
首先感谢大侠,因为能让父母往美国打电话,是非常有意义的一件事。
我用的是英国的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