Skip to content
Ruby interface to AT-compatible GSM modems
Ruby
Latest commit 898dcf5 Oct 7, 2013 @adammck Merge pull request #3 from JakubOboza/master
Made it compatible with Ruby 2.0
Failed to load latest commit information.
bin
lib Update core.rb Jun 17, 2013
spec added test for upcoming AT+CFUN after 5 errors Apr 23, 2009
.gitignore added gem to ignore Dec 18, 2008
README.rdoc fixed example and added new example with just sending message code Oct 5, 2013
rubygsm.gemspec fixed gemspec to support ruby 2.0 and build at all :) Oct 5, 2013

README.rdoc

RubyGSM is a Ruby library which uses ruby-serialport to provide a nifty interface to send and receive SMS messages via a GSM modem.

Sample Usage

class ReverseApp
    def initialize(gsm)
        gsm.receive(method(:incoming))
        @gsm = gsm
    end

    def incoming(from, datetime, message)
        @gsm.send(from, message.reverse)
    end
end

gsm = Gsm::Modem.new("/dev/tty.usbserial")
ReverseApp.new(gsm)

If you just want to send sms

gsm = Gsm::Modem.new("/dev/tty.usbserial")
msg = Gsm::Outgoing.new(gsm, "+447777777777", "Oh hai")
msg.send!

Installing

RubyGSM is distributed via GitHub, which you must add as a gem source before installing:

$ sudo gem sources -a http://gems.github.com

The library depends upon ruby-serialport, which is currently maintained on GitHub by Toholio. This library is included as a Gem dependancy, so to install both:

$ sudo gem install adammck-rubygsm

For Debian/Ubuntu users…

The ruby-serialport library is available in the APT repository as a binary package, which is substatially less hassle to install than the Gem, for those who don't have a compiler installed (I prefer not to, on production servers). To install the package via apt, and ignore the Gem dependancy:

$ sudo apt-get install libserialport-ruby
$ sudo gem install --ignore-dependencies adammck-rubygsm

Building gem

$ gem build rubygsm.gemspec

Known issues

There is a known issue when you try to send message to shortcode. Enble :debug to see problem.

Devices Tested

  • Multitech MTCBA

  • Wavecom M1306B

Something went wrong with that request. Please try again.