Code: Select all
when /^000/ then sys.GoogleVoiceCall("user name", "password", "1747xxxxxxx", req.URI.User.to_str)
Code: Select all
when /^000/ then sys.GoogleVoiceCall("user name", "password", "1747xxxxxxx", req.URI.User.to_str)
Code: Select all
case req.URI.User
when /^000(1\d{10})$/ then sys.GoogleVoiceCall("user name", "password", "1747xxxxxxx", "#{$1}")
yes, that's right. I'm looking for a way to cut off the prefix "000" (or any other prefix like "1*") of the dialed number returned by "req.URI.User.to_str".mel2000 wrote:If I understand correctly, you want to send your calls without the 000 prefix?
Because if want to choose to use Google Voice with this prefix, e.g.:Why not just dial without the 000?
That doesn't work.Code: Select all
case req.URI.User when /^000(1\d{10})$/ then sys.GoogleVoiceCall("user name", "password", "1747xxxxxxx", "#{$1}")
The req.URI.User.to_str is a normal Ruby string object so you can manipulate it in any manner you want.Stiefel wrote:I would like to use GVout, when I dial e.g. 0001xxxxxxxxxx, but this means, the first 3 digits ("000") have to be cut off the dialed number of "req.URI.User.to_str". Is it possible to format the number given back by the "req.URI.User.to_str"-string?Code: Select all
when /^000/ then sys.GoogleVoiceCall("user name", "password", "1747xxxxxxx", req.URI.User.to_str)
Code: Select all
dst = req.URI.User.to_str
trimmedDst = dst[3..(dst.length-3)]
when /^000/ then sys.GoogleVoiceCall("user name", "password", "1747xxxxxxx", trimmedDst )
Code: Select all
num = '00012125551212'
case num
when /^000(.+)/ then puts "n2 = #$1"
when /^00(.+)/ then puts "n1 = #$1"
end
Code: Select all
num = '00012125551212'
case num
when /^00(.+)/ then puts "n1 = #$1"
when /^000(.+)/ then puts "n2 = #$1"
end
AlternativelyMikeTelis wrote:If run, this program will print n2 = 12125551212, which is correct. However, if you switch "when" lines:
it will print n1 = 012125551212, not what you wanted!Code: Select all
num = '00012125551212' case num when /^00(.+)/ then puts "n1 = #$1" when /^000(.+)/ then puts "n2 = #$1" end
Code: Select all
num = '00012125551212'
case num
when /^00([^0]+)/ then puts "n1 = #$1"
when /^000(.+)/ then puts "n2 = #$1"
end
Code: Select all
# Dial Plan for GV/IPKALL
# SIP tracing : true or false
sys.Trace = false
sys.Log("** Call from #{req.Header.From.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 = "oXXXXXX@gmail.com"
GV_pwd = "XXXXXX"
GV_nbr = "305XXXXXXX"
SIPnum = "253XXXXXXX" #IPKall nbr
ac = "305" # area code
case req.URI.User
when /^[1]?(976|900|809)/
sys.Log("Calls to pay-per-call line #{req.URI.User} not allowed")
sys.Respond(488, "Call not allowed")
when /^[1]?((800|866|877|888)\d{7})/ then sys.Dial("#{$1}@voiper.ipkall.com") # use free gateway
when /^411/ then sys.Dial("8004664411@voiper.ipkall.com") # use free gateway
when /^[1]?([2-9]\d{2}[2-9]\d{6})/ then sys.GoogleVoiceCall(GV_email,GV_pwd,SIPnum,"1#{$1}",GV_nbr) # 10 or 11 digits
when /^([2-9]\d{6})/ then sys.GoogleVoiceCall(GV_email,GV_pwd,SIPnum,"1#{ac}#{$1}",GV_nbr) # 7 digits
when /^311/ then sys.GoogleVoiceCall(GV_email,GV_pwd,SIPnum,"13127445000",GV_nbr)
else
sys.Log("Calls to #{req.URI.User} not allowed")
sys.Respond(488, "Call not allowed")
end
end
Code: Select all
DialPlan 10:14:49:316: Forwarding incoming call for ossiemaracay@sipsorcery.com to 1 bindings.
NewCall 10:14:49:316: Executing script dial plan for call to sip:ossiemaracay@sipsorcery.com.
DialPlan 10:14:49:316: Commencing Dial with: ossiemaracay@sipsorcery.com.
DialPlan 10:14:49:363: Call leg is for local domain looking up bindings for ossiemaracay@sipsorcery.com for call leg ossiemaracay@sipsorcery.com.
DialPlan 10:14:49:378: 1 found for ossiemaracay@sipsorcery.com.
DialPlan 10:14:49:378: ForkCall commencing call leg to sip:ossiemaracay@72.153.28.125:5060.
DialPlan 10:14:49:378: Switching to sip:ossiemaracay@72.153.28.125:5060 via udp:127.0.0.1:5066.
DialPlan 10:14:49:378: SDP on UAC call had public IP not mangled, RTP socket 66.54.140.46:19050.
DialPlan 10:14:49:472: Information response 100 Trying for sip:ossiemaracay@72.153.28.125:5060.
DialPlan 10:14:49:566: Information response 180 Ringing for sip:ossiemaracay@72.153.28.125:5060.
DialPlan 10:14:49:566: UAS call progressing with Ringing.
DialPlan 10:15:49:582: Response 480 Temporarily not available for sip:ossiemaracay@72.153.28.125:5060.
DialPlan 10:15:50:019: Dial plan execution completed without answering and a last failure status of TemporarilyNotAvailable Temporarily not available.
DialPlan 10:15:50:019: UAS call failed with a response status of 480 and Temporarily not available.