From 985b1052077bc3cd01841a27988054349ff2bc76 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 9 Sep 2024 16:43:18 +0700 Subject: [PATCH 1/2] fixed cannot answer inbound call --- src/lib/SipSession.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/SipSession.ts b/src/lib/SipSession.ts index a311c90..333a18e 100644 --- a/src/lib/SipSession.ts +++ b/src/lib/SipSession.ts @@ -67,7 +67,7 @@ export default class SipSession extends events.EventEmitter { ({ response }: { response: IncomingResponse }) => { this.emit(SipConstants.SESSION_ANSWERED, { status: SipConstants.SESSION_ANSWERED, - callSid: response.hasHeader("X-Call-Sid") + callSid: response?.hasHeader("X-Call-Sid") ? response.getHeader("X-Call-Sid") : null, }); From 4154383755b4a12c327275d87d47d0e995d2cc9d Mon Sep 17 00:00:00 2001 From: Quan HL Date: Fri, 13 Sep 2024 17:41:20 +0700 Subject: [PATCH 2/2] fixed the phone online toggle button is not able to turn off when wss is disconnect --- src/window/phone/index.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/window/phone/index.tsx b/src/window/phone/index.tsx index 3db865e..dd3cd3a 100644 --- a/src/window/phone/index.tsx +++ b/src/window/phone/index.tsx @@ -309,18 +309,24 @@ export const Phone = ({ unregisteredReasonRef.current = ""; } setStatus("disconnected"); - if (isRestartRef.current) { - createSipClient(); - isRestartRef.current = false; + setIsOnline(false); + setIsSwitchingUserStatus(false); + if (sipUA.current) { + sipUA.current.stop(); } if (args.error) { toast({ - title: `Cannot connect to ${sipServerAddress}, ${args.reason}`, + title: `Cannot connect to ${sipServerAddress}${ + args.reason ? `, ${args.reason}` : "" + }`, status: "warning", duration: DEFAULT_TOAST_DURATION, isClosable: true, }); + } else if (isRestartRef.current) { + createSipClient(); + isRestartRef.current = false; } }); // Call Status