Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Loop of long sms #35

Open
ArturLewinsky opened this issue Sep 4, 2019 · 0 comments
Open

Loop of long sms #35

ArturLewinsky opened this issue Sep 4, 2019 · 0 comments

Comments

@ArturLewinsky
Copy link

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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant