2013-09-11 11:12:22 +02:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'smsd'
|
|
|
|
require 'net/http'
|
|
|
|
|
|
|
|
cli = SMSd::CLI.new(ARGV) do
|
2013-11-07 11:03:25 +01:00
|
|
|
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')
|
2013-09-11 11:12:22 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2013-11-07 11:03:25 +01:00
|
|
|
cli.modem.prefered_storage('SM')
|
2013-09-11 11:12:22 +02:00
|
|
|
cli.run
|