Skip to content

Commit

Permalink
fix: small widget fixes and improvements [WTEL-4002]
Browse files Browse the repository at this point in the history
  • Loading branch information
dlohvinov committed Nov 2, 2023
1 parent 559818a commit 29f4afb
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/app/components/utils/wt-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:class="[
`wt-button--color-${color}`,
{
'wt-button--wide': wide,
'wt-button--disabled': disabled,
}
]"
Expand All @@ -23,6 +24,10 @@ export default {
default: 'accent',
options: ['accent', 'secondary', 'danger'],
},
wide: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -66,6 +71,9 @@ export default {
background: var(--negative-color);
}
}
&--wide {
width: 100%;
}
&--disabled {
pointer-events: none;
color: var(--text-primary-color);
Expand Down
2 changes: 2 additions & 0 deletions src/app/css/variables/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

--icon-main-color: hsla(202, 100%, 15%, 1);
--icon-contrast-color: hsla(0, 0%, 100%, 1);
--icon-error-color: var(--negative-color);
--icon-success-color: var(--positive-color);

--telegram-color: hsla(213, 56%, 67%, 1);
--viber-color: hsla(267, 46%, 46%, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 5px;
width: 280px;
}
}
</style>
10 changes: 4 additions & 6 deletions src/modules/call/components/wt-omni-widget-call-active.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
>
<call-title-wrapper>
{{ duration }}
<template #description>
{{ sessionDTMF }}
</template>
</call-title-wrapper>
<wt-input
:value="sessionDTMF"
type="number"
@input="sendDTMF"
></wt-input>
<numpad
@input="sendDTMF"
></numpad>
Expand All @@ -24,7 +22,7 @@
<wt-icon-btn
icon="call-decline"
icon-size="sm"
color="danger"
color="error"
@click="hangup"
></wt-icon-btn>
</call-actions-wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@click="toggleMute"
></wt-icon-btn>
<wt-icon-btn
color="danger"
color="error"
icon="call-decline"
icon-size="sm"
@click="hangup"
Expand Down
1 change: 1 addition & 0 deletions src/modules/call/components/wt-omni-widget-call-start.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<wt-icon-btn
icon="call"
icon-size="sm"
color="success"
@click="() => makeCall({ initWithMuted })"
></wt-icon-btn>
</call-actions-wrapper>
Expand Down
16 changes: 13 additions & 3 deletions src/modules/call/store/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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 {
Expand Down

0 comments on commit 29f4afb

Please sign in to comment.