rick (owner)

Revisions

gist: 147390 Download_button fork
public
Public Clone URL: git://gist.github.com/147390.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env ruby
 
require 'rubygems'
require 'agi'
require 'ruby-growl'
 
thing = ''
begin
  agi = AGI.new
  thing << [ agi.env['callerid'], agi.env['calleridname']].join("\n")
rescue Exception => e
  thing << "Error: #{e.inspect}"
end
 
1.upto(254) do |i|
  host = "192.168.1.#{i}"
  g = Growl.new host, 'incoming phone call', ["incoming phone call"]
  begin
    g.notify "incoming phone call", "incoming phone call", thing
  rescue Errno::ECONNREFUSED => e
    puts "skipping host #{host}: #{e}"
  rescue Errno::EACCES => e
    puts "skipping host #{host}: #{e}"
  end
end
 
exit 2