had to adjust for SMS Short codes in New Zealand where the minimum can be 3 digits (12 length hex string)
This commit is contained in:
@@ -220,10 +220,10 @@
|
|||||||
while ((match = cmglRegex.exec(data)) !== null) {
|
while ((match = cmglRegex.exec(data)) !== null) {
|
||||||
const index = parseInt(match[1]);
|
const index = parseInt(match[1]);
|
||||||
const senderHex = match[2];
|
const senderHex = match[2];
|
||||||
// Maximum world wide phone number length is 17, UTF-16BE Hex string comes back at 48+ for US Number, min lenght is 4.
|
// Maximum world wide phone number length is 17 (North Korea), UTF-16BE Hex string comes back at 48+ for US Number, min length is 3.
|
||||||
// When 4 digit SMS short code is used the result is a 16 length string (which we then need to check if the sender hex starts with 003 or 002(+))
|
// When 3 digit SMS short code is used the result is a 12 length string (which we then need to check if the sender hex starts with 003 or 002B(+))
|
||||||
// This check is probably completley unecessary but I have no data on how the modems behave around the world otherwise.
|
// This check is probably completley unecessary but I have no data on how the modems behave with different firmware(whether support for CSCS="UCS2" is available).
|
||||||
const sender = senderHex.length > 15 && (senderHex.startsWith('002B') || senderHex.startsWith('003')) ? this.convertHexToText(senderHex) : senderHex;
|
const sender = senderHex.length > 11 && (senderHex.startsWith('002B') || senderHex.startsWith('003')) ? this.convertHexToText(senderHex) : senderHex;
|
||||||
const dateStr = match[3].replace(/\+\d{2}$/, "");
|
const dateStr = match[3].replace(/\+\d{2}$/, "");
|
||||||
const date = this.parseCustomDate(dateStr);
|
const date = this.parseCustomDate(dateStr);
|
||||||
if (isNaN(date)) {
|
if (isNaN(date)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user