Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6977029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:34:24+00:00 2026-05-27T17:34:24+00:00

I have a trying to send SMS messages with ruby-smpp. Following the project examples

  • 0

I have a trying to send SMS messages with ruby-smpp. Following the project examples and some research into em-redis and eventmachine, I have the following gateway.rb configuration:

loop do
  EventMachine::run do             
    @@tx = EventMachine::connect(
      config[:host], 
      config[:port], 
      Smpp::Transceiver, 
      config, 
      self    # delegate that will receive callbacks on MOs and DRs and other events
    )

    MessageSender.next     # gets the messages from redis list and sends at each click of the EventMachine

  end
  puts "Disconnected. Reconnecting in 5 seconds.."
  sleep 5
end

MessageSender is this module:

module MessageSender

  def self.redis
    @redis ||= EM::Hiredis.connect
  end

  def self.next
    redis.blpop("company-out", 0) do |item| 
      if item[1]
        message_hashed = JSON.parse(item[1])
        CompanyGateway.send_mt(message_hashed["from"], 
                               message_hashed["to"], 
                               message_hashed["message"])
      end      
      EM.next_tick(&method(:next))  
    end    
  end  

end

What works: I start the gateway and connect to SMSC simulator. I add messages to redis list and it gets sent fine.
What breaks: There are already values in the redis list, and running gateway.rb breaks with following error:

Exception in SMS Gateway: Transceiver is unbound. Cannot send MT messages. at /vagrant/lib/ruby-smpp/lib/smpp/transceiver.rb:28:in `send_mt'
/vagrant/lib/ruby-smpp/gateways/ucellgate.rb:87:in `send_mt'
/vagrant/lib/ruby-smpp/gateways/ucellgate.rb:66:in `block in next'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/client.rb:149:in `block in method_missing'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `call'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `set_deferred_status'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:173:in `succeed'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/client.rb:75:in `block in connect'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/event_emitter.rb:8:in `call'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/event_emitter.rb:8:in `block in emit'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/event_emitter.rb:8:in `each'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/event_emitter.rb:8:in `emit'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/em-hiredis-0.1.0/lib/em-hiredis/connection.rb:21:in `receive_data'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/home/vagrant/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/vagrant/lib/ruby-smpp/gateways/ucellgate.rb:103:in `block in start'
/vagrant/lib/ruby-smpp/gateways/ucellgate.rb:102:in `loop'
/vagrant/lib/ruby-smpp/gateways/ucellgate.rb:102:in `start'
/vagrant/lib/ruby-smpp/gateways/ucellgate.rb:186:in `<main>'

I would like to be able to run the gateway regardless of redis list is empty or not, and send both the stored messages and the ones that arrive in the list in the future. Any advice?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:34:24+00:00Added an answer on May 27, 2026 at 5:34 pm

    This doesn’t look like a redis issue. The exception is coming from CompanyGateway.send_mt. My guess would be, when you startup with items on the redis queue, you try to send messages before the connection has completed.

    You could try wrapping the initial MessageSender.next call in an EM.add_timer(5) { MessageSender.next } to delay the initial call a few seconds to allow the connection to complete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm kinda new to Flex. I have trying to send Hash from Ruby on
I'm trying to send a file using ftp. I have the following code: string
I have the following where I'm trying to send list/array to MVC controller method:
im trying to send rest api Users.getLoggedInUser i have all the secret session and
I have been trying to encrypt soap message and send to the server, so
I have a very simple workflow that is just trying to send an email
I am trying to send raw xml to a service in Python. I have
I have a bit of a strange problem. I am trying to send in-app
I have been trying to send an email by C#. I have Googled for
I have been trying to find out if MSbuild can send an email to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.