From 64043fa37e7bcac80f8acbfefdabd14a9f0a315b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A9=D7=9C=D7=9E=D7=94?= <78599753+ShlomoCode@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:45:42 +0200 Subject: [PATCH] fix: hangup handling outside the function --- README.md | 3 +++ lib/yemot_router.js | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18d1da0..b866b1b 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ npm i yemot-router2 **5.1.0** כל הפרמטרים שמתחילים במילה Api (פרמטרים אוטומטיים של ימות), לדוגמה `ApiExtension`, `ApiPhone`, כן מוזרקים אוטומטית לאובייקט הCall. + +**5.1.1** +תוקן באג שבו ניתוק מחוץ לפונקציה (לדוגמה השמעת id_list_message, יציאה מהשלוחה ואז ניתוק) היה מפעיל את הפונקציה.
diff --git a/lib/yemot_router.js b/lib/yemot_router.js index 42aa486..82e2f79 100644 --- a/lib/yemot_router.js +++ b/lib/yemot_router.js @@ -95,6 +95,10 @@ function YemotRouter (options = {}) { let currentCall = activeCalls[callId]; if (!currentCall) { isNewCall = true; + if (req.query.hangup === 'yes') { + logger(callId, '👋 call is hangup (outside the function)'); + return res.json({ message: 'hangup' }); + } currentCall = new Call(callId, eventsEmitter, ops); activeCalls[callId] = currentCall; logger(callId, `📞 new call from ${req.query.ApiPhone}`); diff --git a/package-lock.json b/package-lock.json index 7449997..377ea9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "yemot-router", - "version": "5.1.0", + "version": "5.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "yemot-router2", - "version": "5.1.0", + "version": "5.1.1", "license": "ISC", "dependencies": { "colors": "^1.4.0", diff --git a/package.json b/package.json index 755e48b..e292f35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yemot-router2", - "version": "5.1.0", + "version": "5.1.1", "description": "", "main": "index.js", "scripts": {