faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
386 stars 304 forks source link

PDU is unaware of User Data Header #17

Closed jonathanendersby closed 11 years ago

jonathanendersby commented 11 years ago

I've got an SMS in PDU mode.

0591721891F1400781721881F800003160526104848059050003C30101916536FB1DCABEEB2074D85E064941B19CAB060319A5C522289C96D3D3ED32286C0FA7D96131BBEC024941B19CAB0603DDD36C36A88C87A7E565D0DB0D82C55EB0DB4B068BCD5C20

When I decode it with gsmmodem's pdu the first few characters of the message are extended characters, which I suspect are actually the User Data Header.

If I use the decoder on http://smstools3.kekekasvi.com/topic.php?id=288 it extracts the correct SMS text, but also identifies the "User Data Header" as 05 00 03 C3 01 01

You can read more about the UDH at http://en.wikipedia.org/wiki/User_Data_Header

Output from http://smstools3.kekekasvi.com/topic.php?id=288:

SMS DELIVER (receive) Receipt requested: no SMSC: 2781191 Sender: 2781188 TOA: 81 unknown, Numbering Plan: unknown TimeStamp: 25/06/13 16:40:48 GMT +02:00 TP-PID: 00 TP-DCS: 00 TP-DCS-desc: Uncompressed Text, No class Alphabet: Default (7bit) User Data Header: 05 00 03 C3 01 01

Hello!You have R 19.50 FREE airtime available. R 19.50 will expire on 01/07/2013. Length: 89

jonathanendersby commented 11 years ago

FYI, I've temporarily hacked https://github.com/pmarti/python-messaging in to decode PDUs and it decodes those messages correctly.

faucamp commented 11 years ago

Thanks for the report! Yes, using python-messaging was an option I considered, but I felt it was a bit too large for what I wanted to accomplish with python-gsmmodem (I tried keeping dependencies to a minimum to make the project less daunting to use). Either way, I'll implement UDH support in python-gsmmodem's PDU encoder/decoder, and perhaps include support for using python-messaging if detected at runtime.

faucamp commented 11 years ago

python-gsmmodem now natively supports decoding and encoding UDH information elements in PDU mode, and supports encoding concatenated SMS PDUs (5122db44eb6e97926642ec17aaa739296baace68). I'm closing this ticket as resolved - please feel free to re-open it if it doesn't work for you.

On a side note, the real reason python-gsmmodem does not suppport using python-messaging is because of its incompatible license (python-messaging is GPL, python-gsmmodem is LGPL). However, since a large portion of the python-messaging code was originally written by me and is available under the LGPL (and the remainder of python-messaging's functionality is now essentially implemented in python-gsmmodem), I may release a less restrictive alternative to it if there is a demand. :)

Thanks again for the report and your valuable advice!