Skip to content

Loop of long sms #35

@ArturLewinsky

Description

@ArturLewinsky

Hello,
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions