Don't receive a long text message in loop

114 views Asked by At

I' am trying to send loop of long text messages. I get only receive 80% percent of this sms on my own number. In the case of normal text messages, the problem doesn't occur. I would like to know what this is caused, I tried on several modems ...

This is my code responsible for sending sms:

def loop(url_get, sms, sm):
    list_sms = sms.get_sms(url_get)
    if list_sms:
        for send in list_sms:
            status = sms.long_send_message(sm, send['text'] + str(send['id']), send['phone'], 0)
            time.sleep(5)

            if status:
                msg = 'success'
                print(msg)
            else:
                msg = 'failed'
                print(msg)

            sms.post_result_sms(send['id'], status, msg, gammu.SMSCounter(send['text'])[0])

 def long_send_message(self, sm, text, number):
        smsinfo = {
            'Class': 1,
            'Unicode': False,
            'Entries': [
                {
                    'ID': 'ConcatenatedTextLong',
                    'Buffer':
                        text
                }
            ]}

        encoded = gammu.EncodeSMS(smsinfo)

        status = True
        for message in encoded:
            message['Number'] = number

            try:
                sm.SendSMS(message)
            except gammu.GSMError:
                status = False
        return status ```
0

There are 0 answers