Now working with multi messages

This commit is contained in:
2015-06-02 17:12:41 +02:00
parent 415c835574
commit f157672c49
2 changed files with 20 additions and 19 deletions
+10 -17
View File
@@ -60,7 +60,7 @@ function smsResp(status, callback) {
while (sms.pduObjs[i] !== undefined) {
tasks.push(async.apply(
sms.session.sendReturn,
sms.pduObjs[i],
sms.pduObjs[i].pduObj,
status,
{'message_id': sms.smsId},
false
@@ -70,15 +70,6 @@ function smsResp(status, callback) {
}
async.parallel(tasks, callback);
/*
sms.session.sendReturn(
sms.pduObj,
status,
{'message_id': sms.smsId},
false,
callback
);
*/
}
/**
@@ -479,7 +470,10 @@ function session(sock) {
}]
};
} else {
returnObj.longSmses[longSmsId].pduObjs.push(pduObj);
returnObj.longSmses[longSmsId].pduObjs.push({
'partNr': pduObj.params.short_message[5], // We save this here to easier sort the array later on
'pduObj': pduObj
});
}
// Check the long messages tmp storage to see if we should handle them
@@ -528,12 +522,11 @@ function session(sock) {
// These are needed for references here and there in functions
'session': returnObj,
'pduObjs': smsGroup.pduObjs,
'from': smsGroup.pduObjs[0].params.source_addr,
'to': smsGroup.pduObjs[0].params.destination_addr,
'from': smsGroup.pduObjs[0].pduObj.params.source_addr,
'to': smsGroup.pduObjs[0].pduObj.params.destination_addr,
'submitTime': new Date(),
'message': '',
'dlr': Boolean(smsGroup.pduObjs[0].params.registered_delivery),
'dlr': Boolean(smsGroup.pduObjs[0].pduObj.params.registered_delivery),
'sendResp': smsResp,
'sendDlr': smsDlr
};
@@ -545,10 +538,10 @@ function session(sock) {
i = 0;
while (smsObj.pduObjs[i] !== undefined) {
curPduObj = smsObj.pduObjs[i];
curPduObj = smsObj.pduObjs[i].pduObj;
curPduObj.session = returnObj;
smsObj.message += utils.decode(curPduObj.params.short_message, curPduObj.params.data_coding, curPduObj.params.short_message[0]);
smsObj.message += utils.decodeMsg(curPduObj.params.short_message, curPduObj.params.data_coding, curPduObj.params.short_message[0]);
i ++;
}
+10 -2
View File
@@ -488,8 +488,16 @@ function pduReturn(pdu, status, params, tlvs, callback) {
params = {};
}
if (pdu === undefined || pdu.cmdName === undefined || pdu.seqNr === undefined) {
err = new Error('larvitsmpp: lib/utils.js: pduReturn() - Invalid call PDU, cannot create response PDU');
if (pdu === undefined) {
err = new Error('larvitsmpp: lib/utils.js: pduReturn() - PDU is undefined, cannot create response PDU');
}
if (pdu.cmdName === undefined) {
err = new Error('larvitsmpp: lib/utils.js: pduReturn() - pdu.cmdName is undefined, cannot create response PDU');
}
if (pdu.seqNr === undefined) {
err = new Error('larvitsmpp: lib/utils.js: pduReturn() - pdu.seqNr is undefined, cannot create response PDU');
}
if (err === null && defs.errors[status] === undefined) {