Claim an error only where the state failed, and freeze the two state lists
This commit is contained in:
+2
-2
@@ -131,10 +131,10 @@ export function parseReceipt(message: string): Receipt {
|
||||
type MessageType = 'intermediate' | 'other' | 'receipt' | 'unmarked';
|
||||
|
||||
/** SMPP 3.4 Appendix B lists every other receipt state as final. */
|
||||
export const transientStates: MessageState[] = ['ENROUTE', 'SCHEDULED'];
|
||||
export const transientStates: readonly MessageState[] = ['ENROUTE', 'SCHEDULED'];
|
||||
|
||||
/** Written by the far-end SME, not by the MC reporting on a message we submitted. */
|
||||
const smeMessageTypes: number[] = [
|
||||
const smeMessageTypes: readonly number[] = [
|
||||
consts.ESM_CLASS.CONVERSATION_ABORT,
|
||||
consts.ESM_CLASS.DELIVERY_ACKNOWLEDGEMENT,
|
||||
consts.ESM_CLASS.USER_ACKNOWLEDGEMENT,
|
||||
|
||||
+2
-1
@@ -128,6 +128,7 @@ async function sendResp(
|
||||
/** The receipt as text, which is all of it a peer below SMPP 3.4 is allowed to be sent. */
|
||||
function receiptText(sms: Sms, smsId: string, status: MessageState): string {
|
||||
const delivered = status === 'DELIVERED';
|
||||
const failed = !delivered && !transientStates.includes(status);
|
||||
|
||||
return [
|
||||
`id:${smsId}`,
|
||||
@@ -136,7 +137,7 @@ function receiptText(sms: Sms, smsId: string, status: MessageState): string {
|
||||
`submit date:${smppDate(sms.submitTime)}`,
|
||||
`done date:${smppDate(new Date())}`,
|
||||
`stat:${receiptCodes[status]}`,
|
||||
`err:${delivered ? '000' : '001'}`,
|
||||
`err:${failed ? '001' : '000'}`,
|
||||
'text:',
|
||||
].join(' ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user