Skip to content

Commit 4f4acd8

Browse files
author
Ilya Averyanov
committed
Merge branch 'master' of github.com:savonarola/smppsend
* 'master' of github.com:savonarola/smppsend: allow arbitrary inital sequence number
2 parents 68cd84a + db96bfd commit 4f4acd8

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

lib/smppsend.ex

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ defmodule SMPPSend do
5252
wait_dlrs: :integer,
5353
wait: :boolean,
5454

55-
tls: :boolean
55+
tls: :boolean,
56+
57+
sn: :integer
5658
]
5759

5860
@defaults [
@@ -73,7 +75,9 @@ defmodule SMPPSend do
7375
latin1: false,
7476
gsm: false,
7577

76-
wait: false
78+
wait: false,
79+
80+
sn: 0
7781
]
7882

7983
@required [
@@ -225,11 +229,22 @@ defmodule SMPPSend do
225229
defp session_opts(opts) do
226230
session_opts = []
227231

232+
session_opts
233+
|> Keyword.put(:transport, session_transport(opts))
234+
|> Keyword.put(:esme_opts, esme_opts(opts))
235+
end
236+
237+
defp esme_opts(opts) do
238+
esme_opts = []
239+
240+
Keyword.put(esme_opts, :sequence_number, Keyword.get(opts, :sn))
241+
end
242+
243+
defp session_transport(opts) do
228244
if opts[:tls] do
229-
session_opts
230-
|> Keyword.put(:transport, :ranch_ssl)
245+
:ranch_ssl
231246
else
232-
session_opts
247+
:ranch_tcp
233248
end
234249
end
235250

lib/smppsend/usage.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Available options are:
3030
3131
--tls Use ranch_ssl transport
3232
33+
--sn Initial session sequence number
34+
3335
UDH fields (3GPP TS 23.040):
3436
3537
--udh-ref y<ref>

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
1212
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
1313
"ranch": {:hex, :ranch, "1.4.0", "10272f95da79340fa7e8774ba7930b901713d272905d0012b06ca6d994f8826b", [:rebar3], [], "hexpm"},
14-
"smppex": {:hex, :smppex, "2.3.1", "7269458e95fe339f746bec436d2524278d38ebe30f616087faf6aea759b6c02e", [:mix], [{:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
14+
"smppex": {:hex, :smppex, "2.3.2", "49ee396ff8f9e6e36e0e839369372b7762df2d1a8e09da122d8e883e421cfd2c", [:mix], [{:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
1515
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
1616
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"},
1717
}

0 commit comments

Comments
 (0)