augustzf / ruby-smpp

Ruby-implementation of the SMPP protocol, based on EventMachine.

This URL has Read+Write access

name age message
file .gitignore Sat Apr 05 15:55:51 -0700 2008 initial checkin [augustzf]
file CONTRIBUTORS.txt Thu Jan 22 04:22:40 -0800 2009 Uses delegate instead of procs [augustzf]
file History.txt Thu Jan 22 04:22:40 -0800 2009 Uses delegate instead of procs [augustzf]
file License.txt Wed Apr 09 12:37:34 -0700 2008 Cleaned up gem-stuff [augustzf]
file Manifest.txt Thu Jan 22 04:22:40 -0800 2009 Uses delegate instead of procs [augustzf]
file NEWS.txt Thu Jan 22 04:22:40 -0800 2009 Uses delegate instead of procs [augustzf]
file README.rdoc Sat Apr 25 14:37:39 -0700 2009 More rdoc formatting fixes [augustzf]
file Rakefile Wed Apr 09 12:37:34 -0700 2008 Cleaned up gem-stuff [augustzf]
directory config/ Wed Dec 03 08:00:01 -0800 2008 Revert "Update requirements so everything neede... [Jon Wood]
directory examples/ Sat Apr 25 13:58:03 -0700 2009 Cleaned up leftovers [augustzf]
directory lib/ Sat Apr 25 13:58:26 -0700 2009 Added comment on current state of affairs [augustzf]
directory script/ Tue Apr 08 14:23:27 -0700 2008 gemified using newgem [augustzf]
file setup.rb Tue Apr 08 14:23:27 -0700 2008 gemified using newgem [augustzf]
directory tasks/ Wed Apr 09 12:37:34 -0700 2008 Cleaned up gem-stuff [augustzf]
directory test/ Thu Feb 19 08:15:13 -0800 2009 Fixed parsing of deliver_sm for delivery reports [augustzf]
README.rdoc

Ruby-SMPP

DESCRIPTION:

Ruby-SMPP is a Ruby implementation of the SMPP v3.4 protocol. It is suitable for writing gateway daemons that communicate with SMSCs for sending and receiving SMS messages.

The implementation is based on the Ruby/EventMachine library.

Glossary

  • SMSC: SMS Center. Mobile operators normally operate an SMSC in their network. The SMSC stores and forwards SMS messages.
  • MO: Mobile Originated SMS: originated in a mobile phone, ie. sent by an end user.
  • MT: Mobile Terminated SMS: terminated in a mobile phone, ie. received by an end user.
  • DR: Delivery Report, or delivery notification. When you send an MT message, you should receive a DR after a while.
  • PDU: Protcol Base Unit, the data units that SMPP is comprised of. This implementation does not implement all SMPP PDUs.

Protocol

The SMPP 3.4 protocol spec can be downloaded here: smsforum.net/SMPP_v3_4_Issue1_2.zip

Testing/Sample Code

Logica provides an SMPP simulator that you can download from opensmpp.logica.com. You can also sign up for a demo SMPP account at one of the many bulk-SMS providers out there.

For a quick test, download smscsim.jar and smpp.jar from the Logica site, and start the simulator by typing:

  java -cp smscsim.jar:smpp.jar com.logica.smscsim.Simulator

Then type 1 (start simulation), and enter 6000 for port number. The simulator then starts a server socket on a background thread. In another terminal window, start the sample sms gateway from the ruby-smpp/examples directory by typing:

  ruby sample_gateway.rb

You will be able to send MT messages from the sample gateway terminal window by typing the message body. In the simulator terminal window you should see SMPP PDUs being sent from the sample gateway.

You can also send MO messages from the simulator to the sample gateway by typing 7 (log to screen off) and then 4 (send message). MO messages received by the sample gateway will be logged to ./sms_gateway.log.

FEATURES/PROBLEMS:

  • Implements only typical client subset of SMPP 3.4 with single-connection Transceiver.
  • Contributors are encouraged to add missing PDUs.

BASIC USAGE:

Start the transceiver. Receive delegate callbacks whenever incoming messages or delivery reports arrive. Send messages with Transceiver#send_mt.

  # connect to SMSC
  tx = EventMachine::run do
    $tx = EventMachine::connect(
    host,
    port,
    Smpp::Transceiver,
    config,             # a property hash
    delegate            # delegate class that will receive callbacks on MOs and DRs and other events
  end

  # send a message
  tx.send_mt(id, from, to, body)

For a more complete example, see examples/sample_gateway.rb

REQUIREMENTS:

  • Eventmachine >= 0.10.0

INSTALL:

  sudo gem install ruby-smpp

LICENSE:

Copyright © 2008 Apparat AS Released under the MIT license.