mozes / smpp.pdu Goto Github PK
View Code? Open in Web Editor NEWLibrary for parsing Protocol Data Units (PDUs) in SMPP protocol
License: Other
Library for parsing Protocol Data Units (PDUs) in SMPP protocol
License: Other
When i am trying to encode a PDU there's a KeyError
import binascii
import StringIO
from smpp.pdu.pdu_encoding import PDUEncoder
hex = '0000004d00000005000000009f88f12441575342440001013136353035353531323334000101313737333535353430373'
'000000000000000000300117468657265206973206e6f2073706f6f6e'
binary = binascii.a2b_hex(hex)
file = StringIO.StringIO(binary)
pdu = PDUEncoder().decode(file)
print("PDU: %s" % pdu)
This has the following traceback
File "Test.py", line 3, in
from smpp.pdu.pdu_encoding import PDUEncoder
File "/home/prem/smpp.pdu/smpp/pdu/pdu_encoding.py", line 18, in
from smpp.pdu import constants,pdu_types,operations
File "/home/prem/smpp.pdu/smpp/pdu/pdu_types.py", line 20, in
CommandId = Enum(*constants.command_id_name_map.keys())
TypeError: call() takes at most 6 arguments (28 given)
would you please help to decode following PDU?
000000d3000000050000000000000024000000393731353532323332323239000000454920534d53000400000000000000008369643a39333931323831313037353237323730343039207375623a30303120646c7672643a303031207375626d697420646174653a3138303732323137333620646f6e6520646174653a3138303732323137333620737461743a554e44454c4956206572723a32353520746578743a3f3f203f3f3f3f3f204145442035302e3234203f001e001439333931323831313037353237323730343039000427000100
Are optional parameters currently supported? I've been looking at the PDU class and it seems that the optionalParams
field is initialized but not used for anything else. Maybe I'm looking at the wrong place?
(I'm willing to contribute if this is not yet supported but just making sure I don't reinvent anything. :) )
from smpp.pdu.pdu_encoding import PDUEncoder
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pdu_encoding
In OptionEncoder class you did not write classes for self.options parameters for ms_validity,dpf_result,set_dpf,network_error_code,callback_num_pres_ind,callback_num_atag,its_reply_type,its_session_info,ussd_service_op in pdu_encoding.py
First off, this (and your twisted implementation too) are really nice projects.
As you can probably tell from my earlier bug report, I've been having a look at this, and a bit of a play around. However there is no licence file that I can see, so I wanted to find out if it was open source, and if so what licence it is under, as it'd be a nice library to use.
Thanks
In line 764 of pdu/pdu_encoding.py, interface_version is specified to use Int4Encoder, when it is a 1 octet integer (see page 46 of the spec), so should be using Int1Encoder.
File "/usr/lib/python2.7/dist-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 480, in _e
ncodeAsInt
if dataCoding.scheme.index == pdu_types.DataCodingScheme.RAW.index:
exceptions.AttributeError: 'int' object has no attribute 'scheme'
I have an automated deployment system that is attempting to install smpp.pdu via easy_install from PyPI however it is failing due to a missing README.markdown file. It appears this issue has been fixed in Issues 10 and 11 but the fix was never pushed to PyPI. Can you please update PyPI?
Hi,
I tried sending long message for Arabic language (more than 160 characters) using Payload as well as default TLV (0x0424) submit modes but the message always gets delivered as split messages (i.e. it is not delivered as concatenated text message).
I am using same setting for English language it's working fine and message get delivery as single concatenated message .
Any advise is highly appreciated.
Regards,
Manoj
Hi
Wondering if there is any character set conversion in the smpp.pdu library? The closest seems to be in sm_encoding.SMStringEncoder, but then that class doesn't seem to be used anywhere.
We're looking at our support of GSM 3.38 and ISO-8859-1.
Cheers
Brad
When trying to encode a SubmitMulti PDU there's a KeyError, also there seems to be no way to define the dest_address param
import binascii
from smpp.pdu.pdu_types import *
from smpp.pdu.operations import *
from smpp.pdu.pdu_encoding import PDUEncoder
pdu = SubmitMulti(
service_type=None,
esm_class=EsmClass(EsmClassMode.DEFAULT, EsmClassType.DEFAULT),
protocol_id=0,
priority_flag=PriorityFlag.LEVEL_0,
schedule_delivery_time=None,
validity_period=None,
registered_delivery=RegisteredDelivery(RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED),
replace_if_present_flag=ReplaceIfPresentFlag.DO_NOT_REPLACE,
data_coding=DataCoding(DataCodingScheme.GSM_MESSAGE_CLASS, DataCodingGsmMsg(DataCodingGsmMsgCoding.DEFAULT_ALPHABET, DataCodingGsmMsgClass.CLASS_2)),
sm_default_msg_id=None,
source_addr_ton=AddrTon.ALPHANUMERIC,
source_addr_npi=AddrNpi.UNKNOWN,
source_addr='mobileway',
dest_addr_ton=AddrTon.INTERNATIONAL,
dest_addr_npi=AddrNpi.ISDN,
number_of_dests=1,
short_message = 'Hello World!',
)
binary = PDUEncoder().encode(pdu)
This has the following traceback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "smpp/pdu/pdu_encoding.py", line 865, in encode
body = self.encodeBody(pdu)
File "smpp/pdu/pdu_encoding.py", line 906, in encodeBody
body += self.encodeRequiredParams(pdu.mandatoryParams, self.getRequiredParamEncoders(pdu), pdu.params)
File "smpp/pdu/pdu_encoding.py", line 943, in encodeRequiredParams
return string.join([encoderMap[paramName].encode(params[paramName]) for paramName in paramList], '')
KeyError: 'number_of_dests'
If the README.markdown file is to be set as the long description it needs to be included in the package via a MANIFEST.in file or similar.
This issue prevents installation via pip.
The client sends enquirelinks to the server when the sessions.state is not bound, this can be reproduced by simulating a server which delays bind_resp response, in the meanwhile, the client sends enquirelinks and the server will not respond since the client is not authentified "yet".
This can cause a lot of timeouted outbound exceptions, i think it is better to wait for the bind_resp before doing anything.
Am just wondering if this was done basied on some specification, if not, i'll consider it as a bug, fix it and pull it.
at line 427:
def _encodeSchemeDataAsInt(self, dataCoding):
if dataCoding.scheme == pdu_types.DataCodingScheme.GSM_MESSAGE_CLASS:
return self._encodeGsmMsgSchemeDataAsInt(dataCoding)
raise ValueError("Unknown data coding scheme %s" % scheme)
first, scheme is not defined so this code would lead to an error; second the test at line 425:
if dataCoding.scheme == pdu_types.DataCodingScheme.GSM_MESSAGE_CLASS:
should be fixed with casting values with str() to get the test working.
I didnt push a request with this correction because i didnt understand the difference between _encodeSchemeDataAsInt() method and this one (just on top of it):
def _encodeSchemeNameAsInt(self, dataCoding):
schemeName = str(dataCoding.scheme)
if schemeName not in constants.data_coding_scheme_name_map:
raise ValueError("Unknown data_coding scheme name %s" % schemeName)
return constants.data_coding_scheme_name_map[schemeName]
schemeName is casted before the "if" test the right way, so is there any reason why its implemented in a different way in _encodeSchemeDataAsInt()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.