
SPEED_DIAL = {                     	# my speed dial numbers
 '*1'   => 'tux@sipsorcery.com',    # Tux
}

begin

 if sys.Out    # outbound call
   num = req.URI.User.to_s        # Get a string copy of the number to dial
   num = SPEED_DIAL[num] || num   # Substitute with speed dial entry, if any

  if num =~ /@/ 	# Make sure we have an @ sign 
      sys.Log "**URI DIAL** --> #{num}"
      sys.Dial num   # URI dialing
  else
     sys.Log "Error - not supoprted"	# No @ sign - not calling a SIP number but probably calling a PSTN
  end

 else          # sys.Out

# Do nothing - script should not be called for Dial in

 end

rescue
 sys.Log("** Error: " + $!) unless $!.to_s =~ /Thread was being aborted./
end
