Skip to content

Commit 2f6f260

Browse files
author
Kirill Kirsanov
committed
MTS
1 parent c579700 commit 2f6f260

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

client.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,34 @@ def SendMessages(self):
112112
self.sendMessage(sphone, dphone, message)
113113
self.lock.release()
114114

115-
def sendMessage(self, sphone, tphone, message):
115+
def sendMessage(self, sphone, tphone, message, op='tele2'):
116116
from . import gsm
117+
cfg = dict()
118+
119+
nonums = "".join(filter(lambda x: not x.isdigit(), sphone))
120+
121+
if len(nonums)>0:
122+
cfg['source_addr_ton'] = consts.SMPP_TON_ALNUM
123+
cfg['source_addr_npi'] = consts.SMPP_TON_UNK
124+
cfg['dest_addr_ton'] = consts.SMPP_TON_INTL
125+
cfg['dest_addr_npi'] = consts.SMPP_NPI_ISDN
126+
else:
127+
cfg['source_addr_ton']=consts.SMPP_TON_NWSPEC
128+
cfg['source_addr_npi'] = consts.SMPP_NPI_ISDN
129+
cfg['dest_addr_ton'] = consts.SMPP_TON_NATNL
130+
cfg['dest_addr_npi'] = consts.SMPP_NPI_ISDN
117131

118132
try:
119133
parts, encoding_flag, msg_type_flag = gsm.make_parts(message)
120134

121135
for part in parts:
122136
pdu = self.send_message(
123137

124-
source_addr_ton=consts.SMPP_TON_NWSPEC,
125-
source_addr_npi=consts.SMPP_NPI_ISDN,
138+
source_addr_ton=cfg['source_addr_ton'],
139+
source_addr_npi=cfg['source_addr_npi'],
126140
source_addr=sphone, # '1591',
127-
128-
dest_addr_ton=consts.SMPP_TON_NATNL,
129-
dest_addr_npi=consts.SMPP_NPI_ISDN,
141+
dest_addr_ton=cfg['dest_addr_ton'],
142+
dest_addr_npi=cfg['dest_addr_npi'],
130143
# Make sure thease two params are byte strings, not unicode:
131144
destination_addr=tphone,
132145
short_message=part,

command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def generate_params(self):
152152
elif param.type is ostr:
153153
value = self._generate_ostring(field)
154154
if value:
155-
body += value
155+
body += value#.encode('utf8')
156156
#print value
157157
return body
158158

pdu.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,3 @@ def generate(self):
284284

285285
return header + body
286286

287-
288-
# 1
289-
# big1 = b'0000005b00000005000000002c046bde0001013739353331343938343836000001313539312331313635303538310003000000000000000001311383000200000202000ca0373930343334393030303002040002001a0501000123'
290-
# hearbeat
291-
# ok = b'00000010800000150000000000000001'
292-
# Тест
293-
# test_rur = b'0000006200000005000000002d9e68ce000101373935333134393834383600000131353931233137383838303237000300000000000008000804220435044104421383000200000202000ca037393034333439303030300204000200200501000123'
294-
295-
# id:2108317357 sub:001 dlvrd:001 submit date:1611081450 done date:1611081450 stat:DELIVRD err:000 text:<unprintable_text>
296-
297-
# asd
298-
# 0000005c0000000500000000369d7077000101373935333134393834383600000131353931233139313837313000030000000000000000034173641383000200000202000ca037393034333439303030300204000200370501000123'

0 commit comments

Comments
 (0)