diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js index 9c3942898f2..5aa2526f34f 100644 --- a/dom/system/gonk/ril_consts.js +++ b/dom/system/gonk/ril_consts.js @@ -536,6 +536,51 @@ const PDU_PI_RESERVED = 0x78; const PDU_FCS_OK = 0x00; const PDU_FCS_UNSPECIFIED = 0xFF; +// ST - Status +// Bit 7..0 = 000xxxxx, short message transaction completed +const PDU_ST_0_RECEIVED = 0x00; +const PDU_ST_0_FORWARDED_NO_CONFIRM = 0x01; +const PDU_ST_0_REPLACED_BY_SC = 0x02; +const PDU_ST_0_RESERVED_BEGIN = 0x03; +const PDU_ST_0_SC_SPECIFIC_BEGIN = 0x10; +const PDU_ST_0_SC_SPECIFIC_END = 0x1F; +// Bit 7..0 = 001xxxxx, temporary error, SC still trying to transfer SM +const PDU_ST_1_CONGESTION = 0x20; +const PDU_ST_1_SME_BUSY = 0x21; +const PDU_ST_1_SME_NO_RESPONSE = 0x22; +const PDU_ST_1_SERVICE_REJECTED = 0x23; +const PDU_ST_1_QOS_UNAVAILABLE = 0x24; +const PDU_ST_1_SME_ERROR = 0x25; +const PDU_ST_1_RESERVED_BEGIN = 0x26; +const PDU_ST_1_SC_SPECIFIC_BEGIN = 0x30; +const PDU_ST_1_SC_SPECIFIC_END = 0x3F; +// Bit 7..0 = 010xxxxx, permanent error, SC is not making any more transfer +// attempts +const PDU_ST_2_RPC_ERROR = 0x40; +const PDU_ST_2_DEST_INCOMPATIBLE = 0x41; +const PDU_ST_2_CONNECTION_REJECTED = 0x42; +const PDU_ST_2_NOT_OBTAINABLE = 0x43; +const PDU_ST_2_QOS_UNAVAILABLE = 0x44; +const PDU_ST_2_INTERWORKING_UNAVALIABLE = 0x45; +const PDU_ST_2_VALIDITY_EXPIRED = 0x46; +const PDU_ST_2_DELETED_BY_SME = 0x47; +const PDU_ST_2_DELETED_BY_SC = 0x48; +const PDU_ST_2_SM_MISSING = 0x49; +const PDU_ST_2_RESERVED_BEGIN = 0x4A; +const PDU_ST_2_SC_SPECIFIC_BEGIN = 0x50; +const PDU_ST_2_SC_SPECIFIC_END = 0x5F; +// Bit 7..0 = 011xxxxx, temporary error, SC is not making any more transfer +// attempts +const PDU_ST_3_CONGESTION = 0x60; +const PDU_ST_3_SME_BUSY = 0x61; +const PDU_ST_3_SME_NO_RESPONSE = 0x62; +const PDU_ST_3_SERVICE_REJECTED = 0x63; +const PDU_ST_3_QOS_UNAVAILABLE = 0x64; +const PDU_ST_3_SME_ERROR = 0x65; +const PDU_ST_3_RESERVED_BEGIN = 0x66; +const PDU_ST_3_SC_SPECIFIC_BEGIN = 0x70; +const PDU_ST_3_SC_SPECIFIC_END = 0x7F; + // User Data max length in septets const PDU_MAX_USER_DATA_7BIT = 160; // User Data max length in octets diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 2fb5cb910bb..22d3b32dcf1 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -1555,8 +1555,35 @@ let RIL = { return PDU_FCS_OK; } + let status = message.status; + + // 3GPP TS 23.040 9.2.3.15 `The MS shall interpret any reserved values as + // "Service Rejected"(01100011) but shall store them exactly as received.` + if ((status >= 0x80) + || ((status >= PDU_ST_0_RESERVED_BEGIN) + && (status < PDU_ST_0_SC_SPECIFIC_BEGIN)) + || ((status >= PDU_ST_1_RESERVED_BEGIN) + && (status < PDU_ST_1_SC_SPECIFIC_BEGIN)) + || ((status >= PDU_ST_2_RESERVED_BEGIN) + && (status < PDU_ST_2_SC_SPECIFIC_BEGIN)) + || ((status >= PDU_ST_3_RESERVED_BEGIN) + && (status < PDU_ST_3_SC_SPECIFIC_BEGIN)) + ) { + status = PDU_ST_3_SERVICE_REJECTED; + } + + // Pending. Waiting for next status report. + if ((status >>> 5) == 0x01) { + return PDU_FCS_OK; + } + delete this._pendingSentSmsMap[message.messageRef]; + if ((status >>> 5) != 0x00) { + // TODO: bug 727319 - Notify SMS send failures + return PDU_FCS_OK; + } + if ((options.segmentMaxSeq > 1) && (options.segmentSeq < options.segmentMaxSeq)) { // Not last segment. Send next segment here.