Closed fadasi closed 7 years ago
I illustrated the problem (click on the image):
Converting 7-bit to 8-bit, should begin:
Just a recap:
So that 8th (zero-based) octet is PDU Header, which contains:
Where 0x40 is set on the multipart messages, and then the next N bytes are UDH where N is (UDH[0]+1) and is 5 when UDH[1] (IEI) == 0x00 (concatenated sms); see https://en.wikipedia.org/wiki/User_Data_Header
As for the 7bit decoding, you should really just decode as before and then drop the first M characters of decoded output; where M = ceil(len(UDH) * 8 / 7)
I'm currently testing a modified pdu.c:
sed -i 's/if(PDUTYPE_UDHI(pdu_type) == PDUTYPE_UDHI_HAS_HEADER)/if(PDU_DCS_ALPABET(dcs) != PDU_DCS_ALPABET_7BIT && PDUTYPE_UDHI(pdu_type) == PDUTYPE_UDHI_HAS_HEADER)/' pdu.c
Even without removing the first characters that is much better.
The solution: add a parameter 'char * udh' to the 'EXPORT_DEF pdu_parse const char ' (pdu.c). The function 'static int at_response_cmgr ' (at_response.c) must be adapted.
I happened to bump into this PR for the original bg111 fork: https://github.com/bg111/asterisk-chan-dongle/pull/214/commits/2aba9dd30da7bfe69377c7b4cbf313ce01fa347c
I only glanced at it briefly, but it may be what you're looking for?
Multipart SMS with UCS2 Data Coding Scheme (TP-DCS = 8) are well displayed.
But I have a display problem for multipart SMS with default 7-bit alphabet Data Coding Scheme (TP-DCS = 0).
Display not Ok with ...
... SMS 1 with 3 parts (Message: 11111111111111111111...):
... SMS 2 with 2 parts (Message: Aaaaa Aaaaa ...):
Display Ok with ...
... SMS 3 starting as SMS 1 but truncated to fit on 1 part (Message: 11111111111111111111...):
... SMS 4 starting as SMS 2 but truncated to fit on 1 part (Message: Aaaaa Aaaaa ...):
(You can decode the PDUs using https://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/online-sms-pdu-decoder/ or http://smstools3.kekekasvi.com/topic.php?id=288)
I tried to analyze data, my understanding is that with multipart SMS with default 7-bit alphabet Data Coding Scheme (TP-DCS = 0), a padding bit is added to the first byte of the message (just after the UDH). To display the message text, the first byte must be treated by removing the right bit, the next bytes are then encoded normally.
In my SMS 1 part 1 (Message: 11111111111111111111...):
In my SMS 2 part 1 (Message: Aaaaa Aaaaa ...):