Some issues using this library
I've started to use this library to connect to a SMPP server and I've seen some limitations:
- It is not possible to send multiple SMSs using an alphanumerical sender. The Smpp::Pdu::SubmitMulti has constants in the initialize method. Just replacing this code and using the values from the options hash is possible to send messages:
service_type = options[:service_type]? options[:service_type] :''
source_addr_ton = options[:source_addr_ton]?options[:source_addr_ton]:0 # network specific
source_addr_npi = options[:source_addr_npi]?options[:source_addr_npi]:1 # unknown
number_of_dests = destination_addr_array.length # Max value can be 254
dest_addr_ton = options[:dest_addr_ton]?options[:dest_addr_ton]:1 # international
dest_addr_npi = options[:dest_addr_npi]?options[:dest_addr_npi]:1 # unknown
dest_addresses = build_destination_addresses(destination_addr_array,dest_addr_ton,dest_addr_npi,IS_SMEADDR)
esm_class = options[:esm_class]
protocol_id = options[:protocol_id]?options[:protocol_id]:0
priority_flag = options[:priority_flag]?options[:priority_flag]:0
schedule_delivery_time = options[:schedule_delivery_time]?options[:schedule_delivery_time]:''
validity_period = options[:validity_period]?options[:validity_period]:''
registered_delivery = options[:registered_delivery]?options[:registered_delivery]:1
replace_if_present_flag = options[:replace_if_present_flag]?options[:replace_if_present_flag]:0
data_coding = options[:dcs]
sm_default_msg_id = options[:sm_default_msg_id]?options[:sm_default_msg_id]:0
payload = udh ? udh + short_message : short_message # this used to be (short_message + "\0")
sm_length = payload.length
-
The released version (0.6.0) is far from the master version. The "Transmitter" class doesn't exist and it is not possible to connect to an SMPP server only as a sender.
-
I'm using the version from the master branch and it is not possible to send multiple SMS's if you are connected as a "Transmiter". The solution is just copy/paste the method from the "Transceiver" class or create an intermediate class that implement both the send_mt and the send_multiple_mt methods.
Why don't you fork/patch? Apart from point 2, that must be done by the gem owner, you can do it yourself. If raykruger agrees with your patch he can merge it if you make a pull request.
I'd definitely like some help here guys. To be honest, I don't work with smpp at all any more so my knowledge of what's needed is quickly fading. Pull requests are the only way change is gonna happen really :)
I've had a hard time even merging pull request though, due to the encoding problems being so prevalent depending on the setup folks are using. I don't have a clean way to test a lot of them either. They all break between ruby 1.9 and 2.0 as well :)
I've continued working on the library and I've added new improvements. As crondaemon suggest, I'm going to create a new branch to include all these changes.
raykrueger, I know that is hard to mantain a module. If you want, I can help you on this task.
:+1: I work for a mobile operator and I have access both to operational setups and to lab setups, with professional testing tools and personnel as well. I can give my support unless I stop work on this topic.
@raykrueger: thaks for the write access, I will do my best :). What about issuing gem 0.7? @jorpiell: are you working on this? Can we close this issue waiting for your pull request?
I've created a new branch and I'm working on that during this week. My scenario is: we have 5 servers and I have to configure them as 1 transceiver and 4 transmitters. The sender can be alphanumerical and it is possible to send hundreds of SMSs at the same time.
I've fixed some bugs in order to satisfy this scenario. But I'm using the code of the branch 1.9 because I'm using Ruby 1.9.3 and I had several encoding problems with the master code. Maybe @raykrueger can explain us if the code of this branch can be also merged with the master.
I've also had problems configuring the EventMachine with Passenger. I will update the documentation with an explanation about this.
@crondaemon, I make a pull request when I finish my tests.
Just ran tests, from the ruby_19 branch, on 1.8.7 (even though it's EOL), 1.9.3 and 2.0.0. The tests all pass on 1.8.7 and 1.9.3.
They all fail in ruby-2.0.0 due to the use of iconv in the Utf8Encoder.
The Utf8Encoder is not used by the library by default, and I don't know of anyone is using it. The test framework isn't much help because the encoding_test is the only thing that IS using the Utf8Encoder, and the tests for it are mixed in with everything else.