Treat 0098 SOAP positive SendSMSResult as success

This commit is contained in:
2026-05-25 15:50:32 +03:30
parent 27bd903e9d
commit 26c3e02d6f
2 changed files with 23 additions and 20 deletions
+5 -2
View File
@@ -51,9 +51,12 @@ for (const mobile of targets) {
const body = await res.text();
const match = body.match(/<SendSMSResult[^>]*>([^<]*)<\/SendSMSResult>/i);
const code = match?.[1]?.trim() ?? '?';
const n = Number(code);
const ok = Number.isFinite(n) ? n >= 0 : false;
const status = ok ? 'OK (accepted by 0098)' : 'FAILED';
console.log(`mobile=${mobile} http=${res.status} RESULT=${code}`);
if (code !== '0') {
console.log(`mobile=${mobile} http=${res.status} RESULT=${code} ${status}`);
if (!ok) {
console.log(body.slice(0, 400));
}
}