-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: small widget fixes and improvements [WTEL-4002]
- Loading branch information
Showing
7 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,13 @@ const actions = { | |
START_USER_AGENT: (context) => { | ||
const socket = new JsSIP.WebSocketInterface(context.rootState.config.call.url); | ||
JsSIP.debug.enable('JsSIP:*'); | ||
|
||
const { hostname } = new URL(context.rootState.config.call.url); | ||
|
||
const configuration = { | ||
sockets: [socket], | ||
uri: 'sip:[email protected]', | ||
// uri: 'sip:[email protected]', | ||
uri: `sip:${context.rootState.config.call.id}@${hostname}`, | ||
register: false, | ||
}; | ||
const userAgent = new JsSIP.UA(configuration); | ||
|
@@ -93,12 +97,13 @@ const actions = { | |
|
||
const options = { | ||
eventHandlers, | ||
mediaConstraints: { audio: !initWithMuted }, | ||
mediaConstraints: { audio: true }, | ||
sessionTimersExpires: 300, | ||
}; | ||
const session = context.state.userAgent.call('sip:[email protected]', options); | ||
window.session = session; | ||
context.commit('SET_SESSION', session); | ||
if (initWithMuted) await context.dispatch('TOGGLE_MUTE', true); | ||
}, | ||
HANGUP: (context) => { | ||
context.state.session.terminate(); | ||
|
@@ -111,8 +116,13 @@ const actions = { | |
session.hold(); | ||
} | ||
}, | ||
TOGGLE_MUTE: (context) => { | ||
TOGGLE_MUTE: (context, value) => { | ||
const { session } = context.state; | ||
// checking typeof because toggle button can send event | ||
if (value !== undefined && typeof value === 'boolean') { | ||
if (value) session.mute(); | ||
else session.unmute(); | ||
} | ||
if (session.isMuted().audio) { | ||
session.unmute(); | ||
} else { | ||
|