Management magazine search

Loading

Monday, July 4, 2011

Send SMS using Ruby – Jupiter Technology

Send SMS using Ruby – Jupiter Technology: "Send SMS using Ruby"

We have setup Itegno 3800 GSM modem on Ubuntu and be able to send SMS using AT command. AT command is good for testing and debugging but we will need some Ruby wrapper to wrap the AT command for hight level use.

There is a script to help you send and receive SMS: http://snippets.dzone.com/posts/show/3647

It works for me:

require ’serialport’
require ‘time’

class GSM

SMSC = “+6598540020″

….

destination_number = “+65xxxxxxxx”

p = GSM.new(:debug => false)

puts p.send_sms(:number => destination_number, :message => “Call me when you see this message! #{Time.now}”)
But this is not something which I am looking for. After searching ‘ruby gsm gem’. I found this gem: http://github.com/jeffrafter/rubygsm. So:

$ sudo gem sources -a http://gems.github.com  
$ sudo apt-get install libserialport-ruby  
$ sudo gem install --ignore-dependencies adammck-rubygsm $irb >require 'rubygems' >require 'rubygsm' >gsm = Gsm::Modem.new('/dev/ttyUSB0' >> Command time out!  What!  After checking up and down I found that Itegno modem is running at baud rate of 11520 not the default 9600  > gsm = Gsm::Modem.new('/dev/ttyUSB2', :warn, 115200) > gsm.send_sms('+65xxxxxxxx', 'It works!') 

‘It works!’


No comments: