jookies / jasmin

Jasmin - Open source SMS gateway
http://jasminsms.com
Other
991 stars 540 forks source link

maxSmLength from configuration #1138

Open kullanici0606 opened 9 months ago

kullanici0606 commented 9 months ago

Currently maxSmLenght is determined by data_coding of the submit_sm, however we have witnessed some buggy smpp servers that required shorter sm lenghts for certain kind of messages (i.e max 100 bytes for binary sms etc). Therefore is it possible to implement a configuration parameter for maxSmLength?

farirat commented 8 months ago

I dont't think this is a config parameter target ..

You may play with the pdu content through interception anyway.

kullanici0606 commented 8 months ago

Following is the part of the code that determines maxSmLength:

https://github.com/jookies/jasmin/blob/e352208f22677b0a0769d1246892cff9558503cf/jasmin/protocols/smpp/operations.py#L150-L175

If it can be specified with an configuration parameter, than it would be a lot easy for the users

Also I couldn't understand what you mean with interception, could you please elobarate it?

To make it more clear my case, here is the sample config and sample code that shows my request (first three lines):

jcli : smppccm -a
Adding a new connector: (ok: save, ko: exit)
> cid Demo
> max_sm_length 100
> ok
        if self.config.maxSmLength is not None:
            # use user defined max sm length
            maxSmLength = self.configMaxSmLength             
        elif kwargs['data_coding'] in [3, 6, 7, 10]:
            # 8 bit coding
            bits = 8
            maxSmLength = 140
            slicedMaxSmLength = maxSmLength - 6
        elif kwargs['data_coding'] in [2, 4, 5, 8, 9, 13, 14]:
            # 16 bit coding
            bits = 16
            maxSmLength = 70
            slicedMaxSmLength = maxSmLength - 3
        else:
            # 7 bit coding is the default
            # for data_coding in [0, 1] or any other invalid value
            bits = 7
            maxSmLength = 160
            slicedMaxSmLength = 153

        longMessage = kwargs['short_message']
        if bits == 16:
            smLength = len(kwargs['short_message']) / 2
        else:
            smLength = len(kwargs['short_message'])

        # if SM is longer than maxSmLength, build multiple SubmitSMs
        # and link them
        if smLength > maxSmLength: