mozes/smpp.pdu

The support for SubmitMulti is not complete

Closed this issue · 2 comments

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'

The application that I wrote this library for did not need the SubmitMulti command and I didn't have time to fully implement it. If you're willing to do it, I think it wouldn't be too much work.

Closing this. No plans for implement this myself.