and it was working but now I receive an error
"There was a missing method exception in your dial plan, please check."
does anyone know what could be wrong
Code: Select all
#Ruby
sys.Log("from=#{req.Header.From.FromURI.User}")
if sys.RegexMatch(req.Header.From.FromURI.User, "anonymous")
sys.Log("Not accepting unknown calls")
sys.Respond(486, "#{sys.Username} Not online")
end #
Speeddial = {
'100' => '100@ixcall.net',
'612' => '612@fwd.pulver.com',
'613' => '613@fwd.pulver.com',
#1
#4
'307' => '307@sip.blueface.ie', #3 Record and Playback Blueface #2 #1
'306' => '306@sip.blueface.ie', #3 DTMF Checker Blueface #2 #1
'305' => '305@sip.blueface.ie', #3 Music Blueface #2 #1
'304' => '304@sip.blueface.ie', #3 Roboto Blueface #2 #1
'303' => '303@sip.blueface.ie', #3 Clock Blueface #2 #1
'302' => '302@sip.blueface.ie', #3 Tellme Blueface #2 #1
'301' => '301@sip.blueface.ie', #3 Echo Test Blueface #2 #1
'300' => '300@sip.blueface.ie', #3 Monkeys Blueface #2 #1
"1233" => "#{sys.Username}@budgetphone-#{sys.Username}" #2
}
# Providers: "key" => "template". Template format: prefix@Provider
VSPtab = {
'0' => "00001@voicetrading-#{sys.Username}",
'1' => "00@voicetrading-#{sys.Username}",
'2' => "00000@voicetrading-#{sys.Username}",
'3' => "@xs4all-#{sys.Username}",
'4' => "@budgetphone-#{sys.Username}",
'5' => "*@sipbroker.com",
'6' => "@huizenwireless.nl",
}
# VoIP provider selection
#blokeringen
def selectVSP
case @num
when /^88299007735/,
/^88299007736/,
/^88299007737/,
/^88299007738/,
/^88299007739/,
/^88299007740/
route(6,"Call to HuizenWireless.nl")
when /^112$/
route(4,"Call to Budgetphone services")
when /^31(800)/,
/^0(800)/
route(3,"Destination - NL toll free")
when /(^1([2-9]\d\d)\d{7,7})/
@num = $1
case $2
when "800", "866", "877", "888"
route('0',"Destination - US toll free")
else
route(0,"Destination - Netherlands")
end
else
route(0,"Default route applied")
end
end
#eindblokeringen
def dial(*args)
sys.Log(@l) unless @l.empty?
if tpl=VSPtab[@p.to_s]
@num = tpl.sub(/\s*@\s*/) {|x| @num+'@'}
end
sys.Dial(@num,*args)
sys.Log("Call failed: code #{@code}, #{@reason}")
sys.Respond(@code,@reason)
if (ptr = sys.LastDialled[0]).nil?
@code = 487; @reason = 'Geannuleerd door Huizen Wireless'
else
ptr = ptr.TransactionFinalResponse
@code = ptr.StatusCode; @reason = ptr.ReasonPhrase
end
end
# ************************** M A I N *************************************
sys.Log("** Call from #{req.Header.From.ToString()} to #{req.URI.User} **")
@l = @p = ''
t = Time.now + (1*60*60) # Get current time and adjust to huizenwireless.nl (GMT+1)
sys.Log(t.strftime('huizenwireless.nl time: %c'))
if sys.In
#Inblock
##77 #eindInblock
# Nacht Service
##66 # # If my ATA is registered
sys.Dial("#{sys.Username}@huizenwireless.nl", 38) # forward all incoming calls to it afther 33 seconde forward to voicemail
sys.Log("#{sys.Username} is not online. or not picking up")
sys.Respond(486, "#{sys.Username} Not online")
else # Outbound call ...
req.Header.From.FromName = "#{sys.Username}"
@num = req.URI.User.to_s
@num = Speeddial[@num] if (Speeddial[@num])
unless @num =~ /@/
@num.gsub!(/%../) {|x| x[1,2].to_i(16).chr}
@num.gsub!(/[^0-9*]/,'')
unless @num.sub!(/^(\+|00|011|810)/,'')
case @num
when /^0(\d{9,9})$/
@num = '31' + $1
when /^[1-9]\d{9,9}$/
@num = '31' + @num
end
end
@p, @l = ''
selectVSP
end # URI
dial
end