Now working with multi messages
This commit is contained in:
+10
-17
@@ -60,7 +60,7 @@ function smsResp(status, callback) {
|
|||||||
while (sms.pduObjs[i] !== undefined) {
|
while (sms.pduObjs[i] !== undefined) {
|
||||||
tasks.push(async.apply(
|
tasks.push(async.apply(
|
||||||
sms.session.sendReturn,
|
sms.session.sendReturn,
|
||||||
sms.pduObjs[i],
|
sms.pduObjs[i].pduObj,
|
||||||
status,
|
status,
|
||||||
{'message_id': sms.smsId},
|
{'message_id': sms.smsId},
|
||||||
false
|
false
|
||||||
@@ -70,15 +70,6 @@ function smsResp(status, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async.parallel(tasks, 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 {
|
} 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
|
// 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
|
// These are needed for references here and there in functions
|
||||||
'session': returnObj,
|
'session': returnObj,
|
||||||
'pduObjs': smsGroup.pduObjs,
|
'pduObjs': smsGroup.pduObjs,
|
||||||
|
'from': smsGroup.pduObjs[0].pduObj.params.source_addr,
|
||||||
'from': smsGroup.pduObjs[0].params.source_addr,
|
'to': smsGroup.pduObjs[0].pduObj.params.destination_addr,
|
||||||
'to': smsGroup.pduObjs[0].params.destination_addr,
|
|
||||||
'submitTime': new Date(),
|
'submitTime': new Date(),
|
||||||
'message': '',
|
'message': '',
|
||||||
'dlr': Boolean(smsGroup.pduObjs[0].params.registered_delivery),
|
'dlr': Boolean(smsGroup.pduObjs[0].pduObj.params.registered_delivery),
|
||||||
'sendResp': smsResp,
|
'sendResp': smsResp,
|
||||||
'sendDlr': smsDlr
|
'sendDlr': smsDlr
|
||||||
};
|
};
|
||||||
@@ -545,10 +538,10 @@ function session(sock) {
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (smsObj.pduObjs[i] !== undefined) {
|
while (smsObj.pduObjs[i] !== undefined) {
|
||||||
curPduObj = smsObj.pduObjs[i];
|
curPduObj = smsObj.pduObjs[i].pduObj;
|
||||||
curPduObj.session = returnObj;
|
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 ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -488,8 +488,16 @@ function pduReturn(pdu, status, params, tlvs, callback) {
|
|||||||
params = {};
|
params = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdu === undefined || pdu.cmdName === undefined || pdu.seqNr === undefined) {
|
if (pdu === undefined) {
|
||||||
err = new Error('larvitsmpp: lib/utils.js: pduReturn() - Invalid call PDU, cannot create response PDU');
|
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) {
|
if (err === null && defs.errors[status] === undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user