summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Godinez <sgodinez@multitech.com>2015-05-07 10:19:34 -0500
committerSean Godinez <sgodinez@multitech.com>2015-05-07 10:19:34 -0500
commitab80a82e2e0f5ea7cdef0394f80e69b377fab779 (patch)
tree50f2206a38b5a2723dbbc957f195fcf7e069f54d
parent70d54c9b06a7c5fc832b3ec7a408102051c7b28a (diff)
downloadsms-utils-ab80a82e2e0f5ea7cdef0394f80e69b377fab779.tar.gz
sms-utils-ab80a82e2e0f5ea7cdef0394f80e69b377fab779.tar.bz2
sms-utils-ab80a82e2e0f5ea7cdef0394f80e69b377fab779.zip
Keep UDH for concatenated SMS0.0.7
-rw-r--r--src/pdu_decode.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/pdu_decode.c b/src/pdu_decode.c
index 643fa15..cbc2009 100644
--- a/src/pdu_decode.c
+++ b/src/pdu_decode.c
@@ -204,7 +204,21 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu)
}
if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) {
- for (i = 0; i < pdu->user_data_len; i++) {
+ // Keep UDH for concatenated SMS.
+ // Otherwise it is impossible to process correctly concatenated SMS.
+ i = 0;
+ if (pdu->type.user_data_header) {
+ for (i = 0; i <= octets[0]; ++i) {
+ pdu->user_data[i] = octets[i];
+ }
+ i = octets[0] + 1; // Set message text start after UDH.
+ // Process octets padding for 7-bit encoding.
+ if (0 != (i * 8) % 7) {
+ pdu->user_data[i] = 0; // set padding data to 0;
+ i++;
+ }
+ }
+ for (; i < pdu->user_data_len; i++) {
pdu->user_data[i] = decode_septet(octets, i);
}
pdu->user_data[i] = '\0';