diff --git a/lib/session/call-session.js b/lib/session/call-session.js index e768c769..22176319 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -1963,6 +1963,17 @@ Duration=${duration} ` } } catch (err) { this.logger.info({err, opts, callSid}, 'CallSession:updateCall - error updating call'); + const {writeAlerts} = this.srf.locals; + try { + writeAlerts({ + alert_type: 'error-updating-call', + account_sid: this.accountSid, + message: err.message, + target_sid: callSid + }); + } catch (err) { + this.logger.error({err}, 'Error writing error-updating-call alert'); + } } } diff --git a/lib/utils/http-requestor.js b/lib/utils/http-requestor.js index 773b5801..3e09f20e 100644 --- a/lib/utils/http-requestor.js +++ b/lib/utils/http-requestor.js @@ -41,7 +41,7 @@ class HttpRequestor extends BaseRequestor { constructor(logger, account_sid, hook, secret) { super(logger, account_sid, hook, secret); - this.method = hook.method || 'POST'; + this.method = hook.method?.toUpperCase() || 'POST'; this.authHeader = basicAuth(hook.username, hook.password); this.backoffMs = 500; @@ -111,7 +111,7 @@ class HttpRequestor extends BaseRequestor { const payload = params ? snakeCaseKeys(params, ['customerData', 'sip', 'env_vars', 'args']) : null; const url = hook.url || hook; - const method = hook.method || 'POST'; + const method = hook.method?.toUpperCase() || 'POST'; let buf = ''; httpHeaders = { ...httpHeaders, @@ -119,7 +119,7 @@ class HttpRequestor extends BaseRequestor { }; assert.ok(url, 'HttpRequestor:request url was not provided'); - assert.ok, (['GET', 'POST'].includes(method), `HttpRequestor:request method must be 'GET' or 'POST' not ${method}`); + assert.ok(['GET', 'POST'].includes(method), `HttpRequestor:request method must be 'GET' or 'POST' not ${method}`); const startAt = process.hrtime(); /* if we have an absolute url, and it is ws then do a websocket connection */