文学城论坛
+A-

sipsorcery dial plan - GV + voipdiscount

mc3361 2011-08-16 15:37:08 ( reads)

下面是一个用Google Voice打美加电话, voipdiscount打其它国家电话的

sipsorcery dial plan

拨号时,打美加直接拨 12125551212,或者 2125551212

打中国或其它国家,011 + 国家号 + 地区号 + 电话号 比如 011861012345678

拨号也可以用国际通用的 + 国家号 + 地区号 + 电话号 比如 +12125551212, +861012345678

==  begin dial plan ============

sys.Log("Log message from default dialplan.")
sys.Log("call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.")

AREA_code = "212" # your area code for 7 digits dialling
GV_name = "my_name@gmail.com" # google voice account name
GV_pass = "mypass_1234" # google voice account password
GV_callback = "2535551212" # google voice call back number
SIP_provider = "voipdiscount" # SIP provider name for international calling

num = req.URI.User.to_s

# re-format telephone number ###

num = num.sub(/^011/,'+') # 011 86 xxx to +86 xxx
num = num.sub(/^00/, '+') # 001 212 xxx to +1 212 xxx

case num
when /^[2-9]d{6}$/ # 7 digits number, add area code
    num = "+1" + AREA_code + num
when /^[1]d{10}$/ # 1 212 555 1212, add +
   num = "+" + num
when /^d{10}$/ # 212 555 1212, add +1
   num = "+1" + num
end

# end of re-format ###

sys.Log ("Final Dial Number = " + num)

case num
# Use Voipdiscount for non US/Canadian numbers
when /^\\+[^1]/,/^\\+1684/,/^\\+1264/,/^\\+1268/,/^\\+1242/,\
     /^\\+1246/,/^\\+1441/,/^\\+1284/,/^\\+1345/,/^\\+1767/,\
     /^\\+1809/,/^\\+1473/,/^\\+1671/,/^\\+1876/,/^\\+1664/,\
     /^\\+1670/,/^\\+1869/,/^\\+1758/,/^\\+1599/,/^\\+1784/,\
     /^\\+1868/,/^\\+1649/,/^\\+1340/
   sys.Dial(num + "@" + SIP_provider)
else
    sys.GoogleVoiceCall(GV_name,GV_pass,GV_callback, num, ".*",3)
end

 

跟帖(9)

mc3361

2011-08-16 15:42:54

sipsorcery里voipdiscount的设置方法

fitwxc

2011-08-16 18:07:31

你这个太深奥了,会把菜鸟搞蒙。我前面的那个比较容易一瓢画葫芦

mc3361

2011-08-16 21:10:24

精简版

fitwxc

2011-08-17 09:40:59

very neat!

mc3361

2011-08-17 10:34:40

要拨7位号码还要加几句

可说可不说

2011-08-17 11:49:25

回复:要拨7位号码还要加几句

mc3361

2011-08-17 13:18:01

你可以用其他voip/sip服务商,但是不能是sipsorcery,因为它不提供长途服务

可说可不说

2011-08-17 15:03:24

回复:你可以用其他voip/sip服务商,但是不能是sipsorcery,因为它不提供长途服务

mc3361

2011-08-17 15:49:24

voipdscount只是sipsorcery里SIP Provider的名称