BTW, thanks everyone especially Aaron for giving us such a good service.
Code: Select all
#Ruby - Default (works)
# Dial Plan for David Newton
# If you need help, please post in our forum
# http://www.mysipswitch.com
# SIP tracing : true or false
sys.Trace = false
sys.Log("call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.")
if sys.In then
# Do your INCOMING call processing customisations here.
sys.Respond(400, "#{sys.Username} Not available")
sys.Log("No incoming call")
else
# Do your OUTGOING call processing customisations here.
GV_email = "xxxxxxx@gmail.com"
GV_pwd = "xxxxxxx"
G5_SIPnum = "1747xxxxxxx"
areaCode = "713"
case req.URI.User
when /^[1]?(976|900|809)/
sys.Log("Calls to #{req.URI.User} not allowed")
sys.Respond(488, "Call not allowed")
when /^00/ then sys.Dial("voip_ms")
when /^1\d{10}/ # 1+10 digits
sys.GoogleVoiceCall(GV_email,GV_pwd,G5_SIPnum,"#{req.URI.User.to_str[0,11]}")
when /^\d{10}/ # 10 digits
sys.GoogleVoiceCall(GV_email,GV_pwd,G5_SIPnum,"1#{req.URI.User.to_str[0,10]}")
when /^\d{7}/ # 7 digits
sys.GoogleVoiceCall(GV_email,GV_pwd,G5_SIPnum,"1#{areaCode}#{req.URI.User.to_str[0,7]}")
else
sys.Log("Calls to #{req.URI.User} not allowed")
sys.Respond(488, "Call not allowed")
end
end