mgaman / PDUlib

Encode/Decode PDU strings for use with most GSM modems. Both 7 bit and 16 bit alphabets are supported.
GNU Lesser General Public License v2.1
22 stars 10 forks source link

Problem with decoding SMS from operator #39

Closed pajates closed 1 year ago

pajates commented 1 year ago

Hello, your PDUlib is best!

Anyway I have problem with decoding SMS from operator and I have no idea why. This is example PDU string:

+CMGL: 0,0,,148 0791246020099990640681991976000832602111455580840500033107010044006F0073006C006500630068006C00690020006A0073006D0065002000730065002C0020007A006500200064006E006500730020006D00610074006500200063006F0020006F0073006C00610076006F007600610074002100200041002000700072006F0074006F007A006500200064006100720065006B00200070 +CMGL: 1,0,,148 079124602009999064068199197600083260211145558084050003310702006F007400650073006900200076007A006400790063006B0079002C0020006E00650063006F002000700072006F00200056006100730020006D0061006D0065002E002000530074006100760074006500200073006500200064006F002000330031002E0037002E0032003000320033002000760020006B007400650072 +CMGL: 2,0,,148 0791246020099990640681991976000832602111455580840500033107030065006B006F006C006900760020004F0032002000500072006F00640065006A006E0065002C0020006E00610068006C0061007300740065002000740061006A006E00650020006E00610072006F007A0065006E0069006E006F007600650020006800650073006C006F0020004E0043004E004E0046004D005A00460054

OK

I try decode many SMS from mobile, even same text like SMS from operator and everything is OK.

Can you check, where is the problem?

Many thanks! Pajates

mgaman commented 1 year ago

I mistakenly thought that this was an unsupported feature problem and closed the issue. Ignore that. I now see the bug properly and am working a fix.

mgaman commented 1 year ago

Here's a temporary fix, change the file pdulib.cpp insert above line 1019 case 0: // issue #39

So you now see case 0: // issue #39 case 2: // national number

Please keep me informed

Best Regards, David

On Wed, Jun 14, 2023 at 11:48 AM pajates @.***> wrote:

Hello, your PDUlib is best!

Anyway I have problem with decoding SMS from operator and I have no idea why. This is example PDU string:

+CMGL: 0,0,,148

0791246020099990640681991976000832602111455580840500033107010044006F0073006C006500630068006C00690020006A0073006D0065002000730065002C0020007A006500200064006E006500730020006D00610074006500200063006F0020006F0073006C00610076006F007600610074002100200041002000700072006F0074006F007A006500200064006100720065006B00200070 +CMGL: 1,0,,148

079124602009999064068199197600083260211145558084050003310702006F007400650073006900200076007A006400790063006B0079002C0020006E00650063006F002000700072006F00200056006100730020006D0061006D0065002E002000530074006100760074006500200073006500200064006F002000330031002E0037002E0032003000320033002000760020006B007400650072 +CMGL: 2,0,,148

0791246020099990640681991976000832602111455580840500033107030065006B006F006C006900760020004F0032002000500072006F00640065006A006E0065002C0020006E00610068006C0061007300740065002000740061006A006E00650020006E00610072006F007A0065006E0069006E006F007600650020006800650073006C006F0020004E0043004E004E0046004D005A00460054

OK

I try decode many SMS from mobile, even same text like SMS from operator and everything is OK.

Can you check, where is the problem?

Many thanks! Pajates

— Reply to this email directly, view it on GitHub https://github.com/mgaman/PDUlib/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3KSTQLD4Y2ZBXWNCIUUZDXLF3HDANCNFSM6AAAAAAZGAPHZY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mgaman commented 1 year ago

The origin address field 0681991976 in your message has address type of number (TON) 81H i.e. bits 6-5-4 are 0-0-0. According to https://en.wikipedia.org/wiki/GSM_03.40 TON is "unknown" and I treat it an an error.
However on reading further I see that "unknown" is legitimate so I shall treat it as such (which is what the temporary fix above does).

mgaman commented 1 year ago

Fixed in release 0.5.9

pajates commented 1 year ago

Sorry for the late response, you are very fast. The fix looks good. I'm waiting for some SMS from the operator and I will check it. Thank you very much! Pajat