funbox/smppex

How can i send sms

sergey-chechaev opened this issue · 6 comments

I don't get it how can I send SMS by smppex?

For example in https://github.com/VoyagerInnovations/esmpp lib i can send sms by
Ids = esmpp:send_sms(C, <<"12345">>, <<"639473371390">>, <<"Hello">>).

Where 12345 number from and 639473371390 mobile number to.

I do:

{:ok, esme} = SMPPEX.ESME.Sync.start_link("122.222.122.122", 12000)
bind = SMPPEX.Pdu.Factory.bind_transmitter("test", "test")
{:ok, _bind_resp} = SMPPEX.ESME.Sync.request(esme, bind)
submit_sm = SMPPEX.Pdu.Factory.submit_sm({"EDTEST", 1, 1},{"79685555555", 1, 1}, "hello!")
{:ok, submit_sm_resp} = SMPPEX.ESME.Sync.request(esme, submit_sm)

But sms does not come

Hello!

Could you please inspect the resulting submit_sm_resp

Hi @savonarola

iex(7)> submit_sm_resp
%SMPPEX.Pdu{command_id: 2147483652, command_status: 0,
 mandatory: %{message_id: "2003D740DC2"}, optional: %{},
 ref: #Reference<0.3390881824.734789634.102914>, sequence_number: 2}

The returned message_id=2003D740DC2 indicates that the sms was successfully accepted by the SMSC. So you should contact your SMSC support to know out why the sms wasn't delivered.

Btw, if you send messages from an alphanumeric number("EDTEST"), you probably should use ton=5 & npi=0, i.e. {"EDTEST", 5, 0} address.

Yes, the issue was about the alphanumeric number and ton=5. Now it works. Thank you.

Hello!

I have also added in 514db9d simplified factory methods for submit_sm which calculate npi/ton automatically for some general cases.

iex(4)> submit_sm = SMPPEX.Pdu.Factory.submit_sm("EDTEST", "79685555555", "hello!")
%SMPPEX.Pdu{
  command_id: 4,
  command_status: 0,
  mandatory: %{
    data_coding: 0,
    dest_addr_npi: 1, <---------
    dest_addr_ton: 1, <---------
    destination_addr: "79685555555",
    registered_delivery: 0,
    short_message: "hello!",
    source_addr: "EDTEST",
    source_addr_npi: 0, <---------
    source_addr_ton: 5 <---------
  },
  optional: %{},
  ref: #Reference<0.2053855058.94633992.78237>,
  sequence_number: 0
}