Commit b0526d9d authored by Muhammadali's avatar Muhammadali

update-

parent 1db3176d
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "4.8.68", "version": "4.8.69",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import styled from 'styled-components'; import styled from 'styled-components';
import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'; import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace';
import { boxDialerWidjetPosition } from '../../lib/boxDialerWidjetPosition'; import { boxDialerWidjetPosition } from '../../lib/boxDialerWidjetPosition';
import {sizePixelPixelSizeFunc} from "../../lib/sizeContext" import { sizePixelPixelSizeFunc } from '../../lib/sizeContext';
const ModalPhoneNumpadStyle = styled.div` const ModalPhoneNumpadStyle = styled.div`
box-shadow: 0 0 20px #00000047; box-shadow: 0 0 20px #00000047;
...@@ -15,8 +15,9 @@ const ModalPhoneNumpadStyle = styled.div` ...@@ -15,8 +15,9 @@ const ModalPhoneNumpadStyle = styled.div`
width: 230px; width: 230px;
position: fixed; position: fixed;
bottom: 120px; bottom: 120px;
transition: ${({switchAnim})=> typeof switchAnim !== 'undefined' ? switchAnim ? '0.2s' : '0s' : '0.2s' }; transition: ${({ switchAnim }) =>
${({switchAnim})=> console.log('switchAnim: ', switchAnim)} typeof switchAnim !== 'undefined' ? (switchAnim ? '0.2s' : '0s') : '0.2s'};
${({ switchAnim }) => console.log('switchAnim: ', switchAnim)}
z-index: 9999; z-index: 9999;
${({ hiddenValue, position, variant }) => ${({ hiddenValue, position, variant }) =>
hiddenValue hiddenValue
...@@ -28,7 +29,7 @@ const ModalPhoneNumpadStyle = styled.div` ...@@ -28,7 +29,7 @@ const ModalPhoneNumpadStyle = styled.div`
grid-template-rows: 40px 1fr; grid-template-rows: 40px 1fr;
grid-gap: 15px; grid-gap: 15px;
cursor: default; cursor: default;
.settingIcon{ .settingIcon {
position: absolute; position: absolute;
font-size: 11px; font-size: 11px;
cursor: pointer; cursor: pointer;
...@@ -103,7 +104,7 @@ const NumberButton = styled.div` ...@@ -103,7 +104,7 @@ const NumberButton = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
${({sizeContext})=> sizePixelPixelSizeFunc(sizeContext, 22)} ${({ sizeContext }) => sizePixelPixelSizeFunc(sizeContext, 22)}
cursor: pointer; cursor: pointer;
height: 33px; height: 33px;
position: relative; position: relative;
...@@ -113,7 +114,8 @@ const NumberButton = styled.div` ...@@ -113,7 +114,8 @@ const NumberButton = styled.div`
? 'orange' ? 'orange'
: status === 'connected' && '#a0c13d' : status === 'connected' && '#a0c13d'
: '#0000007d'}; : '#0000007d'};
transition: ${({switchAnim})=> typeof switchAnim !== 'undefined' ? switchAnim ? '0.3s' : '0s' : '0.3s' }; transition: ${({ switchAnim }) =>
typeof switchAnim !== 'undefined' ? (switchAnim ? '0.3s' : '0s') : '0.3s'};
.callIcon { .callIcon {
color: #0000007d; color: #0000007d;
...@@ -169,7 +171,6 @@ NumberButton.CallButton = styled.div` ...@@ -169,7 +171,6 @@ NumberButton.CallButton = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
.icon { .icon {
margin: 0 auto; margin: 0 auto;
border: 4px solid transparent; border: 4px solid transparent;
width: 8px; width: 8px;
...@@ -210,7 +211,8 @@ NumberButton.CallButtonModal = styled.div` ...@@ -210,7 +211,8 @@ NumberButton.CallButtonModal = styled.div`
padding: 3px 3px 15px 3px; padding: 3px 3px 15px 3px;
border-top-left-radius: 8px; border-top-left-radius: 8px;
border-top-right-radius: 8px; border-top-right-radius: 8px;
transition: ${({switchAnim})=> typeof switchAnim !== 'undefined' ? switchAnim ? '0.1s' : '0s' : '0.1s' }; transition: ${({ switchAnim }) =>
typeof switchAnim !== 'undefined' ? (switchAnim ? '0.1s' : '0s') : '0.1s'};
clip-path: polygon(100% 0, 100% 93%, 57% 93%, 50% 100%, 43% 93%, 0 93%, 0 0); clip-path: polygon(100% 0, 100% 93%, 57% 93%, 50% 100%, 43% 93%, 0 93%, 0 0);
${({ visiblevalue }) => ${({ visiblevalue }) =>
...@@ -236,7 +238,12 @@ NumberButton.CallButtonModalInset = styled.div` ...@@ -236,7 +238,12 @@ NumberButton.CallButtonModalInset = styled.div`
.num_item { .num_item {
text-wrap: nowrap; text-wrap: nowrap;
color: #000; color: #000;
transition: ${({switchAnim})=> typeof switchAnim !== 'undefined' ? switchAnim ? '0.2s' : '0s' : '0.2s' }; transition: ${({ switchAnim }) =>
typeof switchAnim !== 'undefined'
? switchAnim
? '0.2s'
: '0s'
: '0.2s'};
padding: 5px 10px; padding: 5px 10px;
font-size: 14px; font-size: 14px;
margin: 2px 0; margin: 2px 0;
......
/** @format */ /** @format */
import {toast} from 'react-hot-toast'; import { toast } from 'react-hot-toast';
import outcomingringTone from '../sounds/ringtone.wav'; import outcomingringTone from '../sounds/ringtone.wav';
import waitRingTone from '../sounds/ringbacktone.wav'; import waitRingTone from '../sounds/ringbacktone.wav';
import pickSound from '../sounds/dtmf.wav'; import pickSound from '../sounds/dtmf.wav';
import {WebSocketInterface, UA} from 'jssip'; import { WebSocketInterface, UA } from 'jssip';
import tugpng from '../img/tug.png'; import tugpng from '../img/tug.png';
import packageJson from '../../package.json'; import packageJson from '../../package.json';
...@@ -60,8 +60,7 @@ export class BoxDialer { ...@@ -60,8 +60,7 @@ export class BoxDialer {
player; player;
strmTrack; strmTrack;
isRestarting; isRestarting;
globalHistoryData globalHistoryData;
constructor() { constructor() {
this.played = false; this.played = false;
...@@ -92,13 +91,13 @@ export class BoxDialer { ...@@ -92,13 +91,13 @@ export class BoxDialer {
this.options = { this.options = {
eventHandlers: this.uaEvents(), eventHandlers: this.uaEvents(),
mediaConstraints: {audio: true, video: false}, mediaConstraints: { audio: true, video: false },
}; };
} }
setGlobalHistoryData(data){ setGlobalHistoryData(data) {
console.log('setGlobalHistoryData: ', data) console.log('setGlobalHistoryData: ', data);
this.globalHistoryData = data this.globalHistoryData = data;
} }
dialTone(freq1, freq2) { dialTone(freq1, freq2) {
...@@ -201,7 +200,7 @@ export class BoxDialer { ...@@ -201,7 +200,7 @@ export class BoxDialer {
}); });
window.navigator.mediaDevices window.navigator.mediaDevices
.getUserMedia({audio: true}) .getUserMedia({ audio: true })
.then(function (stream) { .then(function (stream) {
console.log( console.log(
'User_Danied_Media_Access', 'User_Danied_Media_Access',
...@@ -308,7 +307,7 @@ export class BoxDialer { ...@@ -308,7 +307,7 @@ export class BoxDialer {
greeting.addEventListener('click', cbk); greeting.addEventListener('click', cbk);
} }
onSoundType({type, bool}) { onSoundType({ type, bool }) {
this.ringtone.remove(); this.ringtone.remove();
this.waitRingTone.remove(); this.waitRingTone.remove();
this.pickSound.remove(); this.pickSound.remove();
...@@ -355,7 +354,7 @@ export class BoxDialer { ...@@ -355,7 +354,7 @@ export class BoxDialer {
} }
} }
sipRegister = ({number, secret, wsurl, isIce}) => { sipRegister = ({ number, secret, wsurl, isIce }) => {
try { try {
if (window?.alovoice_setversion && packageJson?.version) { if (window?.alovoice_setversion && packageJson?.version) {
window.alovoice_setversion(packageJson?.version); window.alovoice_setversion(packageJson?.version);
...@@ -401,6 +400,7 @@ export class BoxDialer { ...@@ -401,6 +400,7 @@ export class BoxDialer {
e, e,
); );
}); });
this.ua.on('disconnected', (e) => { this.ua.on('disconnected', (e) => {
this.onSipStateChange.dynamicValue('pending'); this.onSipStateChange.dynamicValue('pending');
console.log( console.log(
...@@ -434,7 +434,6 @@ export class BoxDialer { ...@@ -434,7 +434,6 @@ export class BoxDialer {
}); });
this.ua.on('connecting', (e) => { this.ua.on('connecting', (e) => {
console.log('%c connecting: ', 'font-size: 22px; color: yellow;', e); console.log('%c connecting: ', 'font-size: 22px; color: yellow;', e);
}); });
this.ua.on('registrationExpiring', (e) => { this.ua.on('registrationExpiring', (e) => {
console.log( console.log(
...@@ -489,34 +488,36 @@ export class BoxDialer { ...@@ -489,34 +488,36 @@ export class BoxDialer {
}); });
if (this.callSession.direction === 'incoming') { if (this.callSession.direction === 'incoming') {
let second;
let second console.log(
console.log('auto_answer is work: ', this.globalHistoryData?.autoAnswer) 'auto_answer is work: ',
this.globalHistoryData?.autoAnswer,
);
if (this.globalHistoryData?.autoAnswer) { if (this.globalHistoryData?.autoAnswer) {
switch (this.globalHistoryData?.autoAnswerSecond) { switch (this.globalHistoryData?.autoAnswerSecond) {
case 1: case 1:
second = 1000 second = 1000;
break break;
case 50: case 50:
second = 5000 second = 5000;
break break;
case 100: case 100:
second = 10000 second = 10000;
break break;
default: default:
second = 0 second = 0;
} }
console.log('auto_answer second: ', second) console.log('auto_answer second: ', second);
setTimeout(() => { setTimeout(() => {
console.log('auto_answer run boxDialer.answerButtonClick()') console.log('auto_answer run boxDialer.answerButtonClick()');
this.answerButtonClick() this.answerButtonClick();
}, second) }, second);
} }
this.showNotification(() => { this.showNotification(() => {
this.answerButtonClick(); this.answerButtonClick();
}); });
this.onSoundType({type: 'ring', bool: true}); this.onSoundType({ type: 'ring', bool: true });
this.setGuiPhoneState({ this.setGuiPhoneState({
funcName: 'modalState', funcName: 'modalState',
stateCode: 'connectingIncoming', stateCode: 'connectingIncoming',
...@@ -546,7 +547,7 @@ export class BoxDialer { ...@@ -546,7 +547,7 @@ export class BoxDialer {
e, e,
); );
// the call has answered // the call has answered
this.onSoundType({type: 'ring', bool: false}); this.onSoundType({ type: 'ring', bool: false });
this.setGuiPhoneState({ this.setGuiPhoneState({
funcName: 'modalState', funcName: 'modalState',
funcParam: { funcParam: {
...@@ -619,7 +620,7 @@ export class BoxDialer { ...@@ -619,7 +620,7 @@ export class BoxDialer {
type: null, type: null,
}); });
this.stopInnerTimer(); this.stopInnerTimer();
this.onSoundType({type: 'ring', bool: false}); this.onSoundType({ type: 'ring', bool: false });
this.closeBxCall(); this.closeBxCall();
this.hangupButtonClick(); this.hangupButtonClick();
this.setGuiPhoneState({ this.setGuiPhoneState({
...@@ -765,7 +766,7 @@ export class BoxDialer { ...@@ -765,7 +766,7 @@ export class BoxDialer {
return sipState && uiStates[sipState] ? uiStates[sipState] : ''; return sipState && uiStates[sipState] ? uiStates[sipState] : '';
} }
callBxMethods({bxMethodName, bxFuncParams, callback}) { callBxMethods({ bxMethodName, bxFuncParams, callback }) {
if (window.BX24 && window.BX24.placement) { if (window.BX24 && window.BX24.placement) {
window?.BX24.placement.call(bxMethodName, bxFuncParams, callback); window?.BX24.placement.call(bxMethodName, bxFuncParams, callback);
} else if (window.alovoicePhone && window.alovoicePhone.callMethods) { } else if (window.alovoicePhone && window.alovoicePhone.callMethods) {
...@@ -778,8 +779,7 @@ export class BoxDialer { ...@@ -778,8 +779,7 @@ export class BoxDialer {
closeBxCall() { closeBxCall() {
if (window.BX24 && window.BX24.placement) { if (window.BX24 && window.BX24.placement) {
window?.BX24.placement.call('CallCardClose', {}, () => { window?.BX24.placement.call('CallCardClose', {}, () => {});
});
} else if ( } else if (
window.alovoicePhone && window.alovoicePhone &&
window.alovoicePhone.callMethods && window.alovoicePhone.callMethods &&
...@@ -789,7 +789,8 @@ export class BoxDialer { ...@@ -789,7 +789,8 @@ export class BoxDialer {
} }
} }
setGuiPhoneState({stateCode, funcName, funcParam}) { setGuiPhoneState({ stateCode, funcName, funcParam }) {
console.log('boxdialer_setGuiPhoneState_states: ', { stateCode, funcName, funcParam })
if (window?.alovoice_wsphone && !!stateCode?.length) { if (window?.alovoice_wsphone && !!stateCode?.length) {
console.log( console.log(
'this_getBxUiState_stateCode', 'this_getBxUiState_stateCode',
...@@ -798,7 +799,7 @@ export class BoxDialer { ...@@ -798,7 +799,7 @@ export class BoxDialer {
); );
this.callBxMethods({ this.callBxMethods({
bxMethodName: 'CallCardSetUiState', bxMethodName: 'CallCardSetUiState',
bxFuncParams: {uiState: this.getBxUiState(stateCode)}, bxFuncParams: { uiState: this.getBxUiState(stateCode) },
callback: (e) => { callback: (e) => {
console.log(e, `CallCardSetUiState method done ${e}`); console.log(e, `CallCardSetUiState method done ${e}`);
}, },
...@@ -817,12 +818,11 @@ export class BoxDialer { ...@@ -817,12 +818,11 @@ export class BoxDialer {
console.log(`%c BXLOG:`, datas, 'background-color: red;'); console.log(`%c BXLOG:`, datas, 'background-color: red;');
} }
onSessionEvent({type, event}) { onSessionEvent({ type, event }) {}
}
selectUser() { selectUser() {
BX.Runtime.loadExtension('ui.entity-selector').then((exports) => { BX.Runtime.loadExtension('ui.entity-selector').then((exports) => {
const {Dialog, TagSelector} = exports; const { Dialog, TagSelector } = exports;
const dialog = new BX.UI.EntitySelector.Dialog({ const dialog = new BX.UI.EntitySelector.Dialog({
// targetNode: button, // targetNode: button,
...@@ -832,7 +832,7 @@ export class BoxDialer { ...@@ -832,7 +832,7 @@ export class BoxDialer {
entities: [ entities: [
{ {
id: 'user', // пользователи id: 'user', // пользователи
options: {selectFields: ['ufPhoneInner']}, options: { selectFields: ['ufPhoneInner'] },
}, },
{ {
id: 'department', // структура компании: выбор только пользователей id: 'department', // структура компании: выбор только пользователей
...@@ -840,7 +840,7 @@ export class BoxDialer { ...@@ -840,7 +840,7 @@ export class BoxDialer {
], ],
events: { events: {
'_Item:onSelect': (event) => { '_Item:onSelect': (event) => {
const {item} = event.getData(); const { item } = event.getData();
const dialog = event.getTarget(); const dialog = event.getTarget();
const selectedItems = dialog.getSelectedItems(); const selectedItems = dialog.getSelectedItems();
...@@ -906,19 +906,10 @@ export class BoxDialer { ...@@ -906,19 +906,10 @@ export class BoxDialer {
} }
skipButtonClick() { skipButtonClick() {
this.onSoundType({type: 'ring', bool: false}); this.onSoundType({ type: 'ring', bool: false });
this.hangupButtonClick(); this.hangupButtonClick();
} }
answerButtonClick() {
this.onSoundType({type: 'ring', bool: false});
this.callSession?.answer(this.options);
this.callSession.connection.addEventListener('addstream', (event) => {
this.remoteAudio.srcObject = event.stream;
this.remoteAudio.play();
});
}
sipSendDTMF(code) { sipSendDTMF(code) {
this.callSession.sendDTMF(code); this.callSession.sendDTMF(code);
} }
...@@ -928,31 +919,32 @@ export class BoxDialer { ...@@ -928,31 +919,32 @@ export class BoxDialer {
} }
muteButtonClick() { muteButtonClick() {
let {audio} = this.callSession.isMuted();
let { audio } = this.callSession.isMuted();
if (audio) { if (audio) {
this.callSession.unmute(); this.callSession.unmute();
console.log('muteButtonClick_unmute'); console.log('muteButtonClick_unmute');
this.onSipStateChange['setCallEvents']({callMute: false}); this.onSipStateChange['setCallEvents']({ callMute: false });
} else { } else {
this.callSession.mute(); this.callSession.mute();
console.log('muteButtonClick_mute'); console.log('muteButtonClick_mute');
this.onSipStateChange['setCallEvents']({callMute: true}); this.onSipStateChange['setCallEvents']({ callMute: true });
} }
} }
holdButtonClick() { holdButtonClick() {
let {local} = this.callSession.isOnHold(); let { local } = this.callSession.isOnHold();
console.log('local: ', local); console.log('local: ', local);
if (local) { if (local) {
this.callSession.unhold(); this.callSession.unhold();
this.onSipStateChange['setCallEvents']({ callHold: false });
this.onSipStateChange['setCallEvents']({callHold: false});
} else { } else {
this.callSession.hold(); this.callSession.hold();
this.onSipStateChange['setCallEvents']({callHold: true}); this.onSipStateChange['setCallEvents']({ callHold: true });
} }
} }
...@@ -961,7 +953,7 @@ export class BoxDialer { ...@@ -961,7 +953,7 @@ export class BoxDialer {
} }
hangupButtonClick() { hangupButtonClick() {
this.onSoundType({type: 'ring', bool: false}); this.onSoundType({ type: 'ring', bool: false });
this.onSipStateChange.innerCallerModal({ this.onSipStateChange.innerCallerModal({
bool: false, bool: false,
type: null, type: null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment