Modifications to Qasims pull request to fix support for UDH header sizes above 1
This commit is contained in:
+7
-14
@@ -366,28 +366,23 @@ function longSms(pduObj) {
|
||||
// Fix: UDH values are stored in HEX and decoding them make it garbage. First OCTET contains
|
||||
// the size of UDH data header. If UDH data header size is 0x05 then field 4 i.e. CSMS
|
||||
// reference number is of one octet otherwise it consists of 2 octets. Other fields can
|
||||
// be found from below reference.
|
||||
// be found from below reference.
|
||||
// reference: https://en.wikipedia.org/wiki/Concatenated_SMS
|
||||
var udhSize = pduObj.params['udhHeader'].size,
|
||||
smsGroupId = pduObj.params['udhHeader'].reference,
|
||||
smsParts = pduObj.params['udhHeader'].totalParts,
|
||||
partNr = pduObj.params['udhHeader'].partNr;
|
||||
|
||||
var longSmsId = pduObj.params.source_addr + '_' + pduObj.params.destination_addr + '_' + smsGroupId;
|
||||
var longSmsId = pduObj.params.source_addr + '_' + pduObj.params.destination_addr + '_' + pduObj.params.udhHeader.reference;
|
||||
|
||||
if (this.longSmses[longSmsId] === undefined) {
|
||||
this.longSmses[longSmsId] = {
|
||||
'created': new Date(),
|
||||
'partsCount': parseInt(smsParts),
|
||||
'udhSize': udhSize, // Saving udh size to remove garbage from message
|
||||
'partsCount': pduObj.params.udhHeader.totalParts,
|
||||
'udhSize': pduObj.params.udhHeader.size, // Saving udh size to remove garbage from message
|
||||
'pduObjs': [{
|
||||
'partNr': partNr, // We save this here to easier sort the array later on
|
||||
'partNr': pduObj.params.udhHeader.partNr, // We save this here to easier sort the array later on
|
||||
'pduObj': pduObj
|
||||
}]
|
||||
};
|
||||
} else {
|
||||
this.longSmses[longSmsId].pduObjs.push({
|
||||
'partNr': partNr, // We save this here to easier sort the array later on
|
||||
'partNr': pduObj.params.udhHeader.partNr, // We save this here to easier sort the array later on
|
||||
'pduObj': pduObj
|
||||
});
|
||||
}
|
||||
@@ -461,9 +456,7 @@ function checkLongSmses() {
|
||||
curPduObj = smsObj.pduObjs[i].pduObj;
|
||||
curPduObj.session = this;
|
||||
|
||||
// Fix: message in pduObj is already decoded we dont need to do it again. Also removing garbade from original message.
|
||||
//smsObj.message += utils.decodeMsg(curPduObj.params.short_message, curPduObj.params.data_coding, curPduObj.params.short_message[0] + 1);
|
||||
smsObj.message += curPduObj.params.short_message.substring(udhSize + 1);
|
||||
smsObj.message += utils.decodeMsg(curPduObj.params.short_message, curPduObj.params.data_coding, udhSize + 1);
|
||||
|
||||
i ++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user