From b9b70debc76145a76e9f46778d0969a4d2ec28e4 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Mon, 27 Sep 2021 10:38:49 -0400 Subject: [PATCH] bugfix: 302 response in rest outdial caused restart --- lib/http-routes/api/create-call.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/http-routes/api/create-call.js b/lib/http-routes/api/create-call.js index d77426cc..a7a7c893 100644 --- a/lib/http-routes/api/create-call.js +++ b/lib/http-routes/api/create-call.js @@ -96,6 +96,9 @@ router.post('/', async(req, res) => { try { const dlg = await srf.createUAC(uri, {...opts, followRedirects: true, keepUriOnRedirect: true}, { cbRequest: (err, inviteReq) => { + /* in case of 302 redirect, this gets called twice, ignore the second */ + if (res.headersSent) return; + if (err) { logger.error(err, 'createCall Error creating call'); res.status(500).send('Call Failure');