7654321 phone numbers pass through to a phone number dialplan below this code
abc123 dials sipsorcery user abc123 on sipsorcery
sip:user@host or user@host or user&host dials out to user@host
skype:skypeuser calls skypeuser with skypeuser@skype.sipnet.ru
gtalk:user@gmail.com or gtalk:user&gmail.com to user_at_gmail.com@gtalk.gtalk2voip.com
msn:user@hotmail.com or msn:user&hotmail.com to user_at_hotmail.com@msn.gtalk2voip.com
yahoo:user@yahoo.com or yahoo:user&yahoo.com to user_at_yahoo.com@yahoo.gtalk2voip.com
aim:user@host.com or aim:user&host.com to user_at_host.com@aim.gtalk2voip.com
icq:user@host.com or icq:user&host.com to user_at_host.com@icq.gtalk2voip.com
if user@host does not work use user&host
http://gtalk2voip.com/faq.shtml
Code: Select all
# Start of dialplan
sys.Log("Call to #{req.URI.User}@#{req.URI.Host}")
toName = req.URI.User.to_s.gsub(/%(..)/){$1.hex.chr}; toHost = req.URI.Host.to_s
toNamearray = toName.split(':', 2); toName = toNamearray[1] || toNamearray[0]
sys.Log("array:#{toNamearray[0]},#{toNamearray[1]}; toName:#{toName} toHost:#{toHost}")
if toName =~ /@/
toHostarray = toName.split('@', 2)
toHost = toHostarray[1]
toName = toHostarray[0]
end
if toName =~ /&/
toHostarray = toName.split('&', 2)
toHost = toHostarray[1]
toName = toHostarray[0]
end
sys.Log("array:#{toNamearray[0]},#{toNamearray[1]}; toName:#{toName} toHost:#{toHost}")
if !toNamearray[1] or toNamearray[0].downcase == 'sip'
if sys.GetCanonicalDomain(toHost) == "sipsorcery.com"
sys.Dial("#{toName}@local") if toName =~ /[a-zA-Z]/ # if dialled sipsorcery name not number
sys.Respond(480, "failed calling #{toName}.") if toName =~ /[a-zA-Z]/ # A failed sip dial, quit dial plan
else
sys.Log("sip call to #{toName}@#{toHost}")
sys.Dial("#{toName}@" << "#{toHost}".downcase) # dial full sip address entered
sys.Respond(480, "failed sip dial.") # A failed sip dial, quit dial plan
end
else
sys.Log("Calling gateway for #{toNamearray[0]}:#{toName}@#{toHost}")
case toNamearray[0].downcase
when 'gtalk' then sys.Dial "#{toName}_at_#{toHost}@gtalk.gtalk2voip.com"
when 'msn' then sys.Dial "#{toName}_at_#{toHost}@msn.gtalk2voip.com"
when 'yahoo' then sys.Dial "#{toName}_at_#{toHost}@yahoo.gtalk2voip.com"
when 'aim' then sys.Dial "#{toName}_at_#{toHost}@aim.gtalk2voip.com"
when 'icq' then sys.Dial "#{toName}_at_#{toHost}@icq.gtalk2voip.com"
when 'skype' then sys.Dial "#{toName}@skype.sipnet.ru"
end
sys.Respond(480, "failed call to #{toNamearray[0]}:#{toName}@#{toHost}") # quit dial plan
end
sys.Respond(480, "(#{req.URI.User}) is a failed SPEED-DIAL") if req.URI.User.to_s != toName
# end of sip dial.
sys.Log("Calling phone number:#{req.URI.User}")
# start of phone-number dialplan example the following
sys.Dial("provider1") # dial phone numbers with provider1