Wouldn't it be nice to get an anouncement on your computer when you receive an incoming call on your Asterisk or CallWeaver telephony server? Don't want to fiddle around with app_notify which is cumbersome on the former and not even ported to the latter? Well, Ruby to the rescue!
You need a couple of gems for this to work. ruby-growl will do the talking to the Growl clients while batphone hooks into Asterisk/CallWeaver:
gem install ruby-growl gem install batphone
Note: As of today, batphone is not yet available as a gem. However, you can download and install it from here instead.
Create the script /opt/bin/growl_call which must be executable by the user under which Asterisk is running:
#!/usr/bin/env rubyrequire 'rubygems' require 'ruby-growl' require 'agi'
agi = AGI.new
message = <<-EOS From: #{agi.env['agi_calleridname']} <#{agi.env['agi_callerid']}> Context: #{agi.env['ogi_context']} Date: #{Time.now.strftime('%Y-%m-%d %H:%m:%S')} EOS
client = Growl.new("{CLIENT}", "CallWeaver", ["incoming call"], nil, '{PASSWORD}') client.notify("incoming call", "Incoming Call", message, 0, true)
Make sure you replace {CLIENT} with the domain name or IP of the Growl client and {PASSWORD} with the password you have set in Growl for remote notifications.
And finally add the following command wherever appropriate in extensions.conf:
Same as above, but you have to replace all occurrances of agi and AGI with the CallWeaver equivalent ogi and OGI. However, there are two exceptions: require 'agi' and AGI.new must not be renamed.
Growl itself is only available on Mac OS X. However, there are third-party ports for other platforms: