Voice Call: fix Plivo webhook method typing

This commit is contained in:
vrknetha
2026-01-13 17:23:26 +05:30
committed by Peter Steinberger
parent 946b0229e8
commit 2579609922

View File

@@ -383,12 +383,24 @@ export function verifyPlivoWebhook(
} }
if (signatureV3 && nonceV3) { if (signatureV3 && nonceV3) {
const method =
ctx.method === "GET" || ctx.method === "POST" ? ctx.method : null;
if (!method) {
return {
ok: false,
version: "v3",
verificationUrl,
reason: `Unsupported HTTP method for Plivo V3 signature: ${ctx.method}`,
};
}
const postParams = toParamMapFromSearchParams(new URLSearchParams(ctx.rawBody)); const postParams = toParamMapFromSearchParams(new URLSearchParams(ctx.rawBody));
const ok = validatePlivoV3Signature({ const ok = validatePlivoV3Signature({
authToken, authToken,
signatureHeader: signatureV3, signatureHeader: signatureV3,
nonce: nonceV3, nonce: nonceV3,
method: ctx.method, method,
url: verificationUrl, url: verificationUrl,
postParams, postParams,
}); });