smsd/examples/monitor.rb
Guillaume DOTT ce8e53a4ed Add possibility to handle specific actions
By defining specific actions, you can define the answer when a
validation error is found on a SMS.
2013-11-07 11:06:27 +01:00

24 lines
485 B
Ruby
Executable File

#!/usr/bin/env ruby
require 'smsd'
require 'net/http'
cli = SMSd::CLI.new(ARGV) do
machine = SMSd::AnsweringMachine.new('I did not understand.',
too_old: 'Your message is too old',
short_number: 'The phone number you are using is too short')
machine.add_action(/ping/i, 'PONG')
machine.add_action(/free/i) do
`free`
end
machine.add_action(/myip/i) do
Net::HTTP.get('icanhazip.com', '/').chomp
end
machine
end
cli.modem.prefered_storage('SM')
cli.run