Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BoxDialer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
BoxDialer
Commits
41c692c1
Commit
41c692c1
authored
Dec 15, 2023
by
Muhammadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2c70425d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
842 additions
and
1045 deletions
+842
-1045
index.jsx
src/components/CallHistoryInputDropdown/index.jsx
+0
-1
index.jsx
src/components/Modal/index.jsx
+0
-7
index.jsx
src/components/ModalPhoneNumpad/index.jsx
+2
-9
style.js
src/components/ModalPhoneNumpad/style.js
+0
-1
index.jsx
src/components/setting/index.jsx
+0
-2
index.jsx
src/components/settingComponents/fixComponent/index.jsx
+0
-2
boxDIaler.js
src/lib/boxDIaler.js
+840
-1014
index.jsx
src/root/index.jsx
+0
-9
No files found.
src/components/CallHistoryInputDropdown/index.jsx
View file @
41c692c1
...
@@ -43,7 +43,6 @@ const CallHistoryInputDropdown = ({
...
@@ -43,7 +43,6 @@ const CallHistoryInputDropdown = ({
.
scrollTo
(
document
.
getElementById
(
'
numbersDiv
'
).
scrollWidth
,
0
);
.
scrollTo
(
document
.
getElementById
(
'
numbersDiv
'
).
scrollWidth
,
0
);
},
[
inputValue
]);
},
[
inputValue
]);
console
.
log
(
'
input_modal:
'
,
modal
,
numberSelectHistory
);
document
.
querySelector
(
'
body
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
document
.
querySelector
(
'
body
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
if
(
modal
)
setModal
(
false
);
if
(
modal
)
setModal
(
false
);
});
});
...
...
src/components/Modal/index.jsx
View file @
41c692c1
...
@@ -13,7 +13,6 @@ import DialpadIcon from '@mui/icons-material/Dialpad';
...
@@ -13,7 +13,6 @@ import DialpadIcon from '@mui/icons-material/Dialpad';
import
CallCardDropDown
from
'
../CallCardDropDown
'
;
import
CallCardDropDown
from
'
../CallCardDropDown
'
;
import
ModalNumpad
from
'
../ModalNumpad
'
;
import
ModalNumpad
from
'
../ModalNumpad
'
;
import
{
useConfigHoldMute
}
from
"
../../storage
"
import
{
useConfigHoldMute
}
from
"
../../storage
"
// import { contextModalEventProperty } from '../../context/modalEventProperty';
const
Modal
=
({
children
,
hidden
,
hangupButton
,
phoneNumber
,
callType
})
=>
{
const
Modal
=
({
children
,
hidden
,
hangupButton
,
phoneNumber
,
callType
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
const
boxDialer
=
window
.
BoxDialer
;
...
@@ -24,7 +23,6 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
...
@@ -24,7 +23,6 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
const
[
transferModel
,
setTransferModel
]
=
useState
(
true
);
const
[
transferModel
,
setTransferModel
]
=
useState
(
true
);
const
[
numpadModal
,
setNumpadModal
]
=
useState
(
false
);
const
[
numpadModal
,
setNumpadModal
]
=
useState
(
false
);
console
.
log
(
'
callType_modal:
'
,
callType
)
useEffect
(()
=>
{
useEffect
(()
=>
{
setModalHidden
(
hidden
);
setModalHidden
(
hidden
);
...
@@ -172,11 +170,6 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
...
@@ -172,11 +170,6 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
<
div
className=
'round'
></
div
>
<
div
className=
'round'
></
div
>
<
p
className=
'name'
>
No name
</
p
>
<
p
className=
'name'
>
No name
</
p
>
</
ModalContainer
.
Head
>
</
ModalContainer
.
Head
>
{
/* <hr />
<ModalContainer.Body rollUp={rollUp}></ModalContainer.Body>
<hr />
<ModalContainer.Bottom rollUp={rollUp}></ModalContainer.Bottom>
<hr /> */
}
{
selectModalType
(
callType
)
}
{
selectModalType
(
callType
)
}
</
ModalContainer
>
</
ModalContainer
>
<
div
className=
'rollUpVesion'
>
<
div
className=
'rollUpVesion'
>
...
...
src/components/ModalPhoneNumpad/index.jsx
View file @
41c692c1
...
@@ -186,9 +186,7 @@ const ModalPhoneNumpad = ({
...
@@ -186,9 +186,7 @@ const ModalPhoneNumpad = ({
},
[
handleKeyUp
]);
},
[
handleKeyUp
]);
// `${Data.getHours()}:${Data.getMinutes()} ${Data.getDate()}.${Data.getMonth()+1}.${Data.getFullYear()}`
// `${Data.getHours()}:${Data.getMinutes()} ${Data.getDate()}.${Data.getMonth()+1}.${Data.getFullYear()}`
const
callButton
=
()
=>
{
const
callButton
=
()
=>
{
// inset if ----------
// -------------------
var
currentTime
=
new
Date
();
var
currentTime
=
new
Date
();
if
(
dynamicValue
===
'
connected
'
)
{
if
(
dynamicValue
===
'
connected
'
)
{
if
(
if
(
...
@@ -196,8 +194,7 @@ const ModalPhoneNumpad = ({
...
@@ -196,8 +194,7 @@ const ModalPhoneNumpad = ({
call_history
.
slice
(
-
1
)[
0
]?.
value
!=
inputValue
call_history
.
slice
(
-
1
)[
0
]?.
value
!=
inputValue
)
{
)
{
let
newCallsStringify
=
JSON
.
stringify
([
let
newCallsStringify
=
JSON
.
stringify
([
...
call_history
,
...
call_history
,
{
{
value
:
inputValue
,
value
:
inputValue
,
time
:
`
${
currentTime
.
getHours
()}
:
${
currentTime
.
getMinutes
()}
${
currentTime
.
getDate
()}
.
${
currentTime
.
getMonth
()}
.
${
currentTime
.
getFullYear
()}
`
,
time
:
`
${
currentTime
.
getHours
()}
:
${
currentTime
.
getMinutes
()}
${
currentTime
.
getDate
()}
.
${
currentTime
.
getMonth
()}
.
${
currentTime
.
getFullYear
()}
`
,
},
},
...
@@ -213,6 +210,7 @@ const ModalPhoneNumpad = ({
...
@@ -213,6 +210,7 @@ const ModalPhoneNumpad = ({
},
},
});
});
}
}
};
};
const
selectFunc
=
(
e
)
=>
{
const
selectFunc
=
(
e
)
=>
{
setInputValue
(
e
);
setInputValue
(
e
);
...
@@ -287,7 +285,6 @@ const ModalPhoneNumpad = ({
...
@@ -287,7 +285,6 @@ const ModalPhoneNumpad = ({
<
p
className=
'call_text'
>
{
translator
.
translate
(
'
CALL
'
)
}
</
p
>
<
p
className=
'call_text'
>
{
translator
.
translate
(
'
CALL
'
)
}
</
p
>
</
div
>
</
div
>
<
div
className=
'right'
onClick=
{
()
=>
setExNum
(
!
exNum
)
}
>
<
div
className=
'right'
onClick=
{
()
=>
setExNum
(
!
exNum
)
}
>
{
/* <KeyboardControlKeyIcon className='icon' /> */
}
<
div
className=
'icon'
></
div
>
<
div
className=
'icon'
></
div
>
</
div
>
</
div
>
</
NumberButton
.
CallButton
>
</
NumberButton
.
CallButton
>
...
@@ -310,10 +307,6 @@ const ModalPhoneNumpad = ({
...
@@ -310,10 +307,6 @@ const ModalPhoneNumpad = ({
))
}
))
}
</
NumberButton
.
CallButtonModalInset
>
</
NumberButton
.
CallButtonModalInset
>
</
NumberButton
.
CallButtonModal
>
</
NumberButton
.
CallButtonModal
>
{
/* <ModalPhoneNumpadStyle.Window
visiblevalue={exNum}
onClick={() => setExNum(false)}
/> */
}
</
NumberButton
>
</
NumberButton
>
</>
</>
)
:
(
)
:
(
...
...
src/components/ModalPhoneNumpad/style.js
View file @
41c692c1
...
@@ -17,7 +17,6 @@ const ModalPhoneNumpadStyle = styled.div`
...
@@ -17,7 +17,6 @@ const ModalPhoneNumpadStyle = styled.div`
bottom: 120px;
bottom: 120px;
transition:
${({
switchAnim
})
=>
transition:
${({
switchAnim
})
=>
typeof
switchAnim
!==
'
undefined
'
?
(
switchAnim
?
'
0.2s
'
:
'
0s
'
)
:
'
0.2s
'
}
;
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
...
...
src/components/setting/index.jsx
View file @
41c692c1
...
@@ -32,8 +32,6 @@ const SettingComponent = ({
...
@@ -32,8 +32,6 @@ const SettingComponent = ({
setSettingPage
(
count
)
setSettingPage
(
count
)
}
}
console
.
log
(
'
elem:
'
,
elem
)
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
settingPage:
'
,
settingPage
)
console
.
log
(
'
settingPage:
'
,
settingPage
)
if
(
elem
){
if
(
elem
){
...
...
src/components/settingComponents/fixComponent/index.jsx
View file @
41c692c1
...
@@ -10,8 +10,6 @@ const FixComponent = () => {
...
@@ -10,8 +10,6 @@ const FixComponent = () => {
const
useColorConfigStore
=
useColorConfig
((
store
)
=>
store
)
const
useColorConfigStore
=
useColorConfig
((
store
)
=>
store
)
console
.
log
(
'
useColorConfig client:
'
,
useColorConfigStore
.
state
.
autoAnswer
)
const
marks
=
[
const
marks
=
[
{
{
value
:
1
,
value
:
1
,
...
...
src/lib/boxDIaler.js
View file @
41c692c1
/** @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
'
;
export
class
BoxDialer
{
export
class
BoxDialer
{
sTransferNumber
;
sTransferNumber
;
oRingTone
;
oRingTone
;
oRingbackTone
;
oRingbackTone
;
oSipStack
;
oSipStack
;
oSipSessionRegister
;
oSipSessionRegister
;
oSipSessionCall
;
oSipSessionCall
;
oSipSessionCallSecond
;
oSipSessionCallSecond
;
oSipSessionTransferCall
;
oSipSessionTransferCall
;
videoRemote
;
videoRemote
;
videoLocal
;
videoLocal
;
remoteAudio
;
remoteAudio
;
bFullScreen
=
false
;
bFullScreen
=
false
;
oNotifICall
;
oNotifICall
;
bDisableVideo
=
false
;
bDisableVideo
=
false
;
viewVideoLocal
;
viewVideoLocal
;
viewVideoRemote
;
viewVideoRemote
;
viewLocalScreencast
;
// <video> (webrtc) or <div> (webrtc4all)
viewLocalScreencast
;
// <video> (webrtc) or <div> (webrtc4all)
oConfigCall
;
oConfigCall
;
callDirection
;
callDirection
;
oReadyStateTimer
;
oReadyStateTimer
;
ringtone
;
ringtone
;
ringbacktone
;
ringbacktone
;
sipState
;
sipState
;
sipBxState
;
sipBxState
;
soundBool
;
soundBool
;
onSipStateChange
=
{};
onSipStateChange
=
{};
callEvetsBoxDialer
;
callEvetsBoxDialer
;
musicContext
;
musicContext
;
gainNode
;
gainNode
;
gainNode
;
gainNode
;
oscillator1
;
oscillator1
;
oscillator2
;
oscillator2
;
extnum
;
extnum
;
timer
=
{
timer
=
{
time
:
0
,
time
:
0
,
type
:
null
,
type
:
null
,
};
};
innerTimer
=
{
innerTimer
=
{
time
:
0
,
type
:
null
,
time
:
0
,
};
type
:
null
,
options
;
};
socket
;
options
;
ua
;
socket
;
testTimer
;
ua
;
testInnerTimer
;
testTimer
;
callSession
;
testInnerTimer
;
sipDomain
;
callSession
;
player
;
sipDomain
;
strmTrack
;
player
;
isRestarting
;
strmTrack
;
globalHistoryData
;
isRestarting
;
globalHistoryData
;
constructor
()
{
this
.
played
=
false
;
constructor
()
{
document
.
body
.
addEventListener
(
'
click
'
,
()
=>
{
this
.
played
=
false
;
this
.
played
=
true
;
document
.
body
.
addEventListener
(
'
click
'
,
()
=>
{
});
this
.
played
=
true
;
this
.
isRestarting
=
false
;
});
this
.
videoRemote
=
document
.
createElement
(
'
video
'
);
this
.
isRestarting
=
false
;
this
.
videoLocal
=
document
.
createElement
(
'
video
'
);
this
.
videoRemote
=
document
.
createElement
(
'
video
'
);
this
.
remoteAudio
=
document
.
createElement
(
'
audio
'
);
this
.
videoLocal
=
document
.
createElement
(
'
video
'
);
this
.
remoteAudio
.
autoplay
=
true
;
this
.
remoteAudio
=
document
.
createElement
(
'
audio
'
);
this
.
remoteAudio
.
autoplay
=
true
;
document
.
body
.
appendChild
(
this
.
videoRemote
);
document
.
body
.
appendChild
(
this
.
videoLocal
);
document
.
body
.
appendChild
(
this
.
videoRemote
);
document
.
body
.
appendChild
(
this
.
remoteAudio
);
document
.
body
.
appendChild
(
this
.
videoLocal
);
document
.
body
.
appendChild
(
this
.
remoteAudio
);
this
.
ringtone
=
new
Audio
(
outcomingringTone
);
this
.
waitRingTone
=
new
Audio
(
waitRingTone
);
this
.
ringtone
=
new
Audio
(
outcomingringTone
);
this
.
pickSound
=
new
Audio
(
pickSound
);
this
.
waitRingTone
=
new
Audio
(
waitRingTone
);
this
.
pickSound
=
new
Audio
(
pickSound
);
this
.
ringtone
.
loop
=
true
;
this
.
waitRingTone
.
loop
=
true
;
this
.
ringtone
.
loop
=
true
;
this
.
waitRingTone
.
loop
=
true
;
this
.
callEvetsBoxDialer
=
{
callHold
:
false
,
callMute
:
null
,
this
.
callEvetsBoxDialer
=
{
};
callHold
:
false
,
callMute
:
null
,
this
.
options
=
{
};
eventHandlers
:
this
.
uaEvents
(),
mediaConstraints
:
{
audio
:
true
,
video
:
false
},
};
this
.
options
=
{
}
eventHandlers
:
this
.
uaEvents
(),
mediaConstraints
:
{
audio
:
true
,
video
:
false
},
setGlobalHistoryData
(
data
)
{
};
console
.
log
(
'
setGlobalHistoryData:
'
,
data
);
}
this
.
globalHistoryData
=
data
;
}
setGlobalHistoryData
(
data
)
{
console
.
log
(
'
setGlobalHistoryData:
'
,
data
);
dialTone
(
freq1
,
freq2
)
{
this
.
globalHistoryData
=
data
;
// merger = context.createChannelMerger(2);
}
// setTimeout(() => {
// console.log('-= sTOPING BY TIMEOUT');
dialTone
(
freq1
,
freq2
)
{
// this.stop();
// merger = context.createChannelMerger(2);
// }, 1000);
// setTimeout(() => {
// if (this.oscillator1 || this.oscillator2) return;
// console.log('-= sTOPING BY TIMEOUT');
// console.log('Begin dialTone:', this.oscillator1, this.oscillator2);
// this.stop();
// this.oscillator1 = this.musicContext.createOscillator();
// }, 1000);
// // this.oscillator1.type = null;
// if (this.oscillator1 || this.oscillator2) return;
// this.oscillator1.frequency.value = freq1;
// console.log('Begin dialTone:', this.oscillator1, this.oscillator2);
// this.gainNode = this.musicContext.createGain
// this.oscillator1 = this.musicContext.createOscillator();
// ? this.musicContext.createGain()
// // this.oscillator1.type = null;
// : this.musicContext.createGainNode();
// this.oscillator1.frequency.value = freq1;
// this.oscillator1.connect(this.gainNode, 0, 0);
// this.gainNode = this.musicContext.createGain
// this.gainNode.connect(this.musicContext.destination);
// ? this.musicContext.createGain()
// this.gainNode.gain.value = 0.1;
// : this.musicContext.createGainNode();
// this.oscillator1.start
// this.oscillator1.connect(this.gainNode, 0, 0);
// ? this.oscillator1.start(0)
// this.gainNode.connect(this.musicContext.destination);
// : this.oscillator1.noteOn(0);
// this.gainNode.gain.value = 0.1;
// // this.gainNode.connect(merger,0,1);
// this.oscillator1.start
// this.oscillator2 = this.musicContext.createOscillator();
// ? this.oscillator1.start(0)
// // this.oscillator2.type = null;
// : this.oscillator1.noteOn(0);
// this.oscillator2.frequency.value = freq2;
// // this.gainNode.connect(merger,0,1);
// this.gainNode = this.musicContext.createGain
// this.oscillator2 = this.musicContext.createOscillator();
// ? this.musicContext.createGain()
// // this.oscillator2.type = null;
// : this.musicContext.createGainNode();
// this.oscillator2.frequency.value = freq2;
// this.oscillator2.connect(this.gainNode);
// this.gainNode = this.musicContext.createGain
// this.gainNode.connect(this.musicContext.destination);
// ? this.musicContext.createGain()
// // this.gainNode.connect(merger,0,0);
// : this.musicContext.createGainNode();
// this.gainNode.gain.value = 0.1;
// this.oscillator2.connect(this.gainNode);
// this.oscillator2.start
// this.gainNode.connect(this.musicContext.destination);
// ? this.oscillator2.start(0)
// // this.gainNode.connect(merger,0,0);
// : this.oscillator2.noteOn(0);
// this.gainNode.gain.value = 0.1;
}
// this.oscillator2.start
// ? this.oscillator2.start(0)
start
()
{
// : this.oscillator2.noteOn(0);
// if (typeof this.oscillator1 != 'undefined') this.oscillator1.disconnect();
}
// if (typeof this.oscillator2 != 'undefined') this.oscillator2.disconnect();
// oscOn(
start
()
{
// parseFloat(document.getElementById('freq').value),
// if (typeof this.oscillator1 != 'undefined') this.oscillator1.disconnect();
// parseFloat(document.getElementById('freq2').value),
// if (typeof this.oscillator2 != 'undefined') this.oscillator2.disconnect();
// );
// oscOn(
}
// parseFloat(document.getElementById('freq').value),
// parseFloat(document.getElementById('freq2').value),
stop
()
{
// );
// console.log('STOP', this.oscillator1, this.oscillator2);
}
// console.log('FUNC', this.oscillator1?.disconnect, this.oscillator1?.stop);
// this.oscillator1?.disconnect();
stop
()
{
// this.oscillator2?.disconnect();
// console.log('STOP', this.oscillator1, this.oscillator2);
// this.oscillator1?.stop();
// console.log('FUNC', this.oscillator1?.disconnect, this.oscillator1?.stop);
// this.oscillator2?.stop();
// this.oscillator1?.disconnect();
// this.oscillator1 = null;
// this.oscillator2?.disconnect();
// this.oscillator2 = null;
// this.oscillator1?.stop();
}
// this.oscillator2?.stop();
// this.oscillator1 = null;
uaEvents
()
{
// this.oscillator2 = null;
return
{
}
progress
:
(
e
)
=>
{
console
.
log
(
'
%c progress
'
,
'
font-size: 22px; color: green;
'
,
e
);
uaEvents
()
{
this
.
onSipStateChange
.
innerCallerModal
({
return
{
bool
:
true
,
type
:
'
connectingOutgoing
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
progress
:
(
e
)
=>
{
});
console
.
log
(
'
%c progress
'
,
'
font-size: 22px; color: green;
'
,
e
);
this
.
setGuiPhoneState
({
// this.hangupButtonClick();
funcName
:
'
modalState
'
,
stateCode
:
'
connectingOutgoing
'
,
funcParam
:
{
// this.closeBxCall();
bool
:
false
,
callType
:
''
,
},
// window.innerCallBegin(true);
});
this
.
onSipStateChange
.
innerCallerModal
({
},
failed
:
(
e
)
=>
{
bool
:
true
,
console
.
log
(
'
%c failed
'
,
'
font-size: 22px; color: green;
'
,
e
);
type
:
'
connectingOutgoing
'
,
if
(
e
?.
cause
)
{
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
toast
.
error
(
e
?.
cause
);
});
}
this
.
setGuiPhoneState
({
this
.
closeBxCall
();
funcName
:
'
modalState
'
,
this
.
onSipStateChange
.
innerCallerModal
({
stateCode
:
'
connectingOutgoing
'
,
bool
:
false
,
type
:
null
,
from
:
''
,
funcParam
:
{
});
bool
:
false
,
this
.
stopInnerTimer
();
callType
:
''
,
if
(
e
.
cause
==
'
User Denied Media Access
'
)
{
},
console
.
log
(
'
User_Danied_Media_Access
'
);
});
toast
.
error
(
'
Your micrafon is OFF
'
,
{
},
style
:
{
failed
:
(
e
)
=>
{
zIndex
:
'
99999999999999999
'
,
console
.
log
(
'
%c failed
'
,
'
font-size: 22px; color: green;
'
,
e
);
},
if
(
e
?.
cause
)
{
});
toast
.
error
(
e
?.
cause
);
}
window
.
navigator
.
mediaDevices
// console.log('call failed with cause: ' + e.data);
.
getUserMedia
({
audio
:
true
})
this
.
closeBxCall
();
.
then
(
function
(
stream
)
{
this
.
onSipStateChange
.
innerCallerModal
({
console
.
log
(
'
User_Danied_Media_Access
'
,
'
You let me use your mic!
'
,);
bool
:
false
,
})
type
:
null
,
.
catch
(
function
(
err
)
{
from
:
''
,
console
.
log
(
'
User_Danied_Media_Access
'
,
'
No mic for you!
'
);
});
});
this
.
stopInnerTimer
();
}
if
(
e
.
cause
==
'
User Denied Media Access
'
)
{
},
ended
:
(
e
)
=>
{
console
.
log
(
'
User_Danied_Media_Access
'
);
console
.
log
(
'
%c ended
'
,
'
font-size: 22px; color: green;
'
);
toast
.
error
(
'
Your micrafon is OFF
'
,
{
this
.
closeBxCall
();
style
:
{
this
.
onSipStateChange
.
innerCallerModal
({
zIndex
:
'
99999999999999999
'
,
bool
:
false
,
type
:
null
,
from
:
''
,
},
});
});
this
.
stopInnerTimer
();
this
.
setGuiPhoneState
({
window
.
navigator
.
mediaDevices
funcName
:
'
modalState
'
,
funcParam
:
{
.
getUserMedia
({
audio
:
true
})
bool
:
false
,
callType
:
''
,
.
then
(
function
(
stream
)
{
},
console
.
log
(
});
'
User_Danied_Media_Access
'
,
this
.
removeViExternalCard
();
'
You let me use your mic!
'
,
},
confirmed
:
(
e
)
=>
{
);
console
.
log
(
'
%c confirmed
'
,
'
font-size: 22px; color: green;
'
,
e
);
})
.
catch
(
function
(
err
)
{
this
.
setGuiPhoneState
({
console
.
log
(
'
User_Danied_Media_Access
'
,
'
No mic for you!
'
);
funcName
:
'
modalState
'
,
});
stateCode
:
'
connected
'
,
}
funcParam
:
{
},
bool
:
true
,
ended
:
(
e
)
=>
{
callType
:
'
connected
'
,
console
.
log
(
'
%c ended
'
,
'
font-size: 22px; color: green;
'
);
callFromName
:
'
Test
'
,
this
.
closeBxCall
();
},
this
.
onSipStateChange
.
innerCallerModal
({
});
bool
:
false
,
type
:
null
,
from
:
''
,
this
.
onSipStateChange
.
innerCallerModal
({
});
bool
:
true
,
type
:
'
connected
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
this
.
stopInnerTimer
();
});
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
this
.
startInnerTimer
();
bool
:
false
,
callType
:
''
,
},
},
};
});
}
this
.
removeViExternalCard
();
},
isUaRunning
()
{
confirmed
:
(
e
)
=>
{
return
(
Boolean
(
typeof
window
.
BX
!==
'
undefined
'
)
&&
Boolean
(
window
.
localStorage
.
getItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
))
&&
Boolean
(
window
.
localStorage
.
getItem
(
'
mycall
'
)));
console
.
log
(
'
%c confirmed
'
,
'
font-size: 22px; color: green;
'
,
e
);
}
// console.log(`%c BXLOG:`, datas, 'background-color: red;');
this
.
onSipStateChange
.
innerCallerModal
({
removeViExternalCard
()
{
bool
:
true
,
// if (
type
:
'
connected
'
,
// typeof BX !== 'undefined' &&
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
// window.localStorage.getItem(BX.bitrix_sessid() + '_mycall') &&
});
// window.localStorage.getItem('mycall')
this
.
startInnerTimer
();
// ) {
this
.
setGuiPhoneState
({
// BX?.localStorage?.remove('viExternalCard');
funcName
:
'
modalState
'
,
// } else if (typeof BX !== 'undefined') {
stateCode
:
'
connected
'
,
// BX?.localStorage?.remove('viExternalCard');
funcParam
:
{
// }
bool
:
true
,
}
callType
:
'
connected
'
,
callFromName
:
'
Test
'
,
startTimer
()
{
},
this
.
testTimer
=
setInterval
(()
=>
{
});
this
.
timer
.
time
=
this
.
timer
.
time
+
1
;
},
this
.
onSipStateChange
.
setDndTimer
(
this
.
timer
.
time
);
};
},
1000
);
}
}
isUaRunning
()
{
stopTimer
()
{
return
(
clearInterval
(
this
.
testTimer
);
Boolean
(
typeof
window
.
BX
!==
'
undefined
'
)
&&
this
.
timer
.
time
=
0
;
Boolean
(
window
.
localStorage
.
getItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
))
&&
this
.
onSipStateChange
.
setDndTimer
(
this
.
timer
.
time
);
Boolean
(
window
.
localStorage
.
getItem
(
'
mycall
'
))
}
);
}
startInnerTimer
()
{
this
.
testInnerTimer
=
setInterval
(()
=>
{
removeViExternalCard
()
{
this
.
innerTimer
.
time
=
this
.
innerTimer
.
time
+
1
;
// if (
this
.
onSipStateChange
.
innerTimer
(
this
.
innerTimer
.
time
);
// typeof BX !== 'undefined' &&
},
1000
);
// window.localStorage.getItem(BX.bitrix_sessid() + '_mycall') &&
}
// window.localStorage.getItem('mycall')
// ) {
stopInnerTimer
()
{
// BX?.localStorage?.remove('viExternalCard');
clearInterval
(
this
.
testInnerTimer
);
// } else if (typeof BX !== 'undefined') {
this
.
innerTimer
.
time
=
0
;
// BX?.localStorage?.remove('viExternalCard');
this
.
onSipStateChange
.
innerTimer
(
this
.
innerTimer
.
time
);
// }
}
}
showNotification
(
cbk
)
{
startTimer
()
{
let
callerId
=
this
.
callSession
.
_remote_identity
.
_uri
.
user
;
this
.
testTimer
=
setInterval
(()
=>
{
const
greeting
=
new
Notification
(
`Звонок от
${
callerId
}
`
,
{
this
.
timer
.
time
=
this
.
timer
.
time
+
1
;
body
:
'
Answer Call
'
,
icon
:
tugpng
,
this
.
onSipStateChange
.
setDndTimer
(
this
.
timer
.
time
);
});
},
1000
);
greeting
.
addEventListener
(
'
click
'
,
cbk
);
}
}
stopTimer
()
{
onSoundType
({
type
,
bool
})
{
clearInterval
(
this
.
testTimer
);
this
.
ringtone
.
remove
();
this
.
timer
.
time
=
0
;
this
.
waitRingTone
.
remove
();
this
.
onSipStateChange
.
setDndTimer
(
this
.
timer
.
time
);
this
.
pickSound
.
remove
();
}
if
(
this
.
played
)
{
switch
(
type
)
{
startInnerTimer
()
{
case
'
ring
'
:
this
.
testInnerTimer
=
setInterval
(()
=>
{
if
(
bool
)
{
this
.
innerTimer
.
time
=
this
.
innerTimer
.
time
+
1
;
this
.
ringtone
.
pause
();
this
.
onSipStateChange
.
innerTimer
(
this
.
innerTimer
.
time
);
this
.
ringtone
.
remove
();
},
1000
);
}
this
.
ringtone
.
play
();
}
else
{
stopInnerTimer
()
{
this
.
ringtone
.
pause
();
clearInterval
(
this
.
testInnerTimer
);
this
.
ringtone
.
remove
();
this
.
innerTimer
.
time
=
0
;
}
this
.
onSipStateChange
.
innerTimer
(
this
.
innerTimer
.
time
);
break
;
}
case
'
wait
'
:
if
(
bool
)
{
showNotification
(
cbk
)
{
this
.
waitRingTone
.
pause
();
let
callerId
=
this
.
callSession
.
_remote_identity
.
_uri
.
user
;
this
.
waitRingTone
.
remove
();
const
greeting
=
new
Notification
(
`Звонок от
${
callerId
}
`
,
{
console
.
log
(
this
.
waitRingTone
,
'
sound waitRingTone
'
);
body
:
'
Answer Call
'
,
icon
:
tugpng
,
this
.
waitRingTone
.
play
();
});
}
else
{
greeting
.
addEventListener
(
'
click
'
,
cbk
);
this
.
waitRingTone
.
pause
();
}
this
.
waitRingTone
.
remove
();
}
onSoundType
({
type
,
bool
})
{
break
;
this
.
ringtone
.
remove
();
case
'
pick
'
:
this
.
waitRingTone
.
remove
();
if
(
bool
)
{
this
.
pickSound
.
remove
();
this
.
pickSound
.
remove
();
if
(
this
.
played
)
{
this
.
pickSound
.
pause
();
switch
(
type
)
{
case
'
ring
'
:
this
.
pickSound
.
play
();
if
(
bool
)
{
}
else
{
this
.
ringtone
.
pause
();
this
.
pickSound
.
pause
();
this
.
ringtone
.
remove
();
this
.
pickSound
.
remove
();
}
this
.
ringtone
.
play
();
break
;
}
else
{
default
:
this
.
ringtone
.
pause
();
console
.
error
(
'
onSoundType: Such a sound does not exist
'
);
this
.
ringtone
.
remove
();
break
;
}
}
break
;
}
case
'
wait
'
:
}
if
(
bool
)
{
this
.
waitRingTone
.
pause
();
sipRegister
=
({
number
,
secret
,
wsurl
,
isIce
})
=>
{
this
.
waitRingTone
.
remove
();
try
{
console
.
log
(
this
.
waitRingTone
,
'
sound waitRingTone
'
);
if
(
window
?.
alovoice_setversion
&&
packageJson
?.
version
)
{
window
.
alovoice_setversion
(
packageJson
?.
version
);
this
.
waitRingTone
.
play
();
}
}
else
{
if
(
this
.
options
)
{
this
.
waitRingTone
.
pause
();
if
(
typeof
BX
!==
'
undefined
'
)
BX
?.
localStorage
?.
remove
(
'
viExternalCard
'
);
this
.
waitRingTone
.
remove
();
}
this
.
socket
=
new
WebSocketInterface
(
`wss://
${
wsurl
}
/ws`
);
break
;
this
.
callSession
=
false
;
case
'
pick
'
:
this
.
sipDomain
=
wsurl
;
if
(
bool
)
{
console
.
log
(
'
ua_configure
'
,
{
this
.
pickSound
.
remove
();
sockets
:
[
this
.
socket
],
this
.
pickSound
.
pause
();
uri
:
`sip:
${
number
}
@
${
wsurl
}
`
,
password
:
secret
,
this
.
pickSound
.
play
();
stun_server
:
'
stun:stun.l.google.com:19302
'
,
}
else
{
});
this
.
pickSound
.
pause
();
this
.
ua
=
new
UA
({
this
.
pickSound
.
remove
();
sockets
:
[
this
.
socket
],
}
uri
:
`sip:
${
number
}
@
${
wsurl
}
`
,
break
;
password
:
secret
,
default
:
stun_server
:
'
stun:stun.l.google.com:19302
'
,
console
.
error
(
'
onSoundType: Such a sound does not exist
'
);
register_expires
:
60
,
break
;
});
}
if
(
typeof
BX
!==
'
undefined
'
)
{
}
console
.
log
(
'
setting_my_call =============================-----------
'
,);
}
window
.
localStorage
.
setItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
,
this
.
ua
.
configuration
.
instance_id
,);
window
.
localStorage
.
setItem
(
'
mycall
'
,
this
.
ua
.
configuration
.
instance_id
,);
sipRegister
=
({
number
,
secret
,
wsurl
,
isIce
})
=>
{
}
try
{
if
(
window
?.
alovoice_setversion
&&
packageJson
?.
version
)
{
this
.
ua
.
on
(
'
connected
'
,
(
e
)
=>
{
window
.
alovoice_setversion
(
packageJson
?.
version
);
console
.
log
(
'
%c sip_register [connected]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
}
});
if
(
this
.
options
)
{
if
(
typeof
BX
!==
'
undefined
'
)
this
.
ua
.
on
(
'
disconnected
'
,
(
e
)
=>
{
BX
?.
localStorage
?.
remove
(
'
viExternalCard
'
);
this
.
onSipStateChange
.
dynamicValue
(
'
pending
'
);
console
.
log
(
'
%c sip_register [disconnected]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
this
.
socket
=
new
WebSocketInterface
(
`wss://
${
wsurl
}
/ws`
);
});
this
.
callSession
=
false
;
this
.
ua
.
on
(
'
registered
'
,
(
e
)
=>
{
this
.
sipDomain
=
wsurl
;
this
.
onSipStateChange
.
dynamicValue
(
'
connected
'
);
console
.
log
(
'
ua_configure
'
,
{
console
.
log
(
'
%c sip_register [registered]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
sockets
:
[
this
.
socket
],
});
uri
:
`sip:
${
number
}
@
${
wsurl
}
`
,
this
.
ua
.
on
(
'
unregistered
'
,
(
e
)
=>
{
password
:
secret
,
console
.
log
(
'
%c sip_register [unregistered]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
stun_server
:
'
stun:stun.l.google.com:19302
'
,
});
});
this
.
ua
=
new
UA
({
this
.
ua
.
on
(
'
registrationFailed
'
,
(
e
)
=>
{
sockets
:
[
this
.
socket
],
console
.
log
(
'
%c sip_register [registrationFailed]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
uri
:
`sip:
${
number
}
@
${
wsurl
}
`
,
});
password
:
secret
,
this
.
ua
.
on
(
'
connecting
'
,
(
e
)
=>
{
stun_server
:
'
stun:stun.l.google.com:19302
'
,
console
.
log
(
'
%c connecting:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
register_expires
:
60
,
});
});
this
.
ua
.
on
(
'
registrationExpiring
'
,
(
e
)
=>
{
if
(
typeof
BX
!==
'
undefined
'
)
{
console
.
log
(
'
%c registrationExpiring:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
console
.
log
(
this
.
ua
.
register
();
'
setting_my_call =============================-----------
'
,
});
);
this
.
ua
.
on
(
'
newMessage
'
,
(
e
)
=>
{
window
.
localStorage
.
setItem
(
console
.
log
(
'
%c newMessage:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
BX
.
bitrix_sessid
()
+
'
_mycall
'
,
});
this
.
ua
.
configuration
.
instance_id
,
this
.
ua
.
on
(
'
sipEvent
'
,
(
e
)
=>
{
);
console
.
log
(
'
%c sipEvent:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
window
.
localStorage
.
setItem
(
});
'
mycall
'
,
this
.
ua
.
on
(
'
newOptions
'
,
(
e
)
=>
{
this
.
ua
.
configuration
.
instance_id
,
console
.
log
(
'
%c newOptions:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
);
});
}
this
.
ua
.
on
(
'
newRTCSession
'
,
(
data
)
=>
{
this
.
ua
.
on
(
'
connected
'
,
(
e
)
=>
{
console
.
log
(
'
%c newRTCSession:
'
,
'
font-size: 22px; color: yellow;
'
,
data
,);
console
.
log
(
this
.
callSession
=
data
.
session
;
'
%c sip_register [connected]:
'
,
'
font-size: 22px; color: yellow;
'
,
if
(
this
.
callSession
&&
this
.
callSession
.
connection
)
{
e
,
this
.
callSession
.
connection
.
onaddstream
=
(
e
)
=>
{
);
this
.
strmTrack
=
e
.
stream
.
getAudioTracks
();
});
if
(
this
.
strmTrack
[
0
])
{
this
.
remoteAudio
.
srcObject
=
new
MediaStream
([
this
.
strmTrack
[
0
],]);
this
.
ua
.
on
(
'
disconnected
'
,
(
e
)
=>
{
this
.
remoteAudio
.
play
();
this
.
onSipStateChange
.
dynamicValue
(
'
pending
'
);
}
console
.
log
(
};
'
%c sip_register [disconnected]:
'
,
}
'
font-size: 22px; color: yellow;
'
,
e
,
);
});
this
.
onSipStateChange
.
innerCallerModal
({
this
.
ua
.
on
(
'
registered
'
,
(
e
)
=>
{
bool
:
true
,
type
:
'
connectingIncoming
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
this
.
onSipStateChange
.
dynamicValue
(
'
connected
'
);
});
console
.
log
(
'
%c sip_register [registered]:
'
,
if
(
this
.
callSession
.
direction
===
'
incoming
'
)
{
'
font-size: 22px; color: yellow;
'
,
this
.
setGuiPhoneState
({
e
,
funcName
:
'
modalState
'
,
funcParam
:
{
);
bool
:
true
,
callType
:
'
incoming
'
,
});
},
this
.
ua
.
on
(
'
unregistered
'
,
(
e
)
=>
{
});
console
.
log
(
let
second
;
'
%c sip_register [unregistered]:
'
,
console
.
log
(
'
auto_answer is work:
'
,
this
.
globalHistoryData
?.
autoAnswer
,);
'
font-size: 22px; color: yellow;
'
,
if
(
this
.
globalHistoryData
?.
autoAnswer
)
{
e
,
switch
(
this
.
globalHistoryData
?.
autoAnswerSecond
)
{
);
case
1
:
});
second
=
1000
;
break
;
this
.
ua
.
on
(
'
registrationFailed
'
,
(
e
)
=>
{
case
50
:
console
.
log
(
second
=
5000
;
'
%c sip_register [registrationFailed]:
'
,
break
;
'
font-size: 22px; color: yellow;
'
,
case
100
:
e
,
second
=
10000
;
);
break
;
});
default
:
this
.
ua
.
on
(
'
connecting
'
,
(
e
)
=>
{
second
=
0
;
console
.
log
(
'
%c connecting:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
}
});
console
.
log
(
'
auto_answer second:
'
,
second
);
this
.
ua
.
on
(
'
registrationExpiring
'
,
(
e
)
=>
{
setTimeout
(()
=>
{
console
.
log
(
console
.
log
(
'
auto_answer run boxDialer.answerButtonClick()
'
);
'
%c registrationExpiring:
'
,
this
.
answerButtonClick
();
'
font-size: 22px; color: yellow;
'
,
},
second
);
e
,
}
);
this
.
ua
.
register
();
this
.
showNotification
(()
=>
{
});
this
.
answerButtonClick
();
this
.
ua
.
on
(
'
newMessage
'
,
(
e
)
=>
{
});
console
.
log
(
'
%c newMessage:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
true
});
});
this
.
setGuiPhoneState
({
this
.
ua
.
on
(
'
sipEvent
'
,
(
e
)
=>
{
funcName
:
'
modalState
'
,
stateCode
:
'
connectingIncoming
'
,
funcParam
:
{
console
.
log
(
'
%c sipEvent:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
bool
:
true
,
callType
:
'
incoming
'
,
});
},
this
.
ua
.
on
(
'
newOptions
'
,
(
e
)
=>
{
});
console
.
log
(
'
%c newOptions:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
// window.innerCallBegin();
this
.
ua
.
on
(
'
newRTCSession
'
,
(
data
)
=>
{
this
.
callSession
.
on
(
'
progress
'
,
(
e
)
=>
{
console
.
log
(
console
.
log
(
'
%c progress:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
'
%c newRTCSession:
'
,
this
.
setGuiPhoneState
({
'
font-size: 22px; color: yellow;
'
,
stateCode
:
'
incoming
'
,
data
,
});
);
});
this
.
callSession
=
data
.
session
;
// incoming call here
this
.
callSession
.
on
(
'
accepted
'
,
()
=>
{
if
(
this
.
callSession
&&
this
.
callSession
.
connection
)
{
console
.
log
(
'
%c newRTCSession accepted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
this
.
callSession
.
connection
.
onaddstream
=
(
e
)
=>
{
// the call has answered
this
.
strmTrack
=
e
.
stream
.
getAudioTracks
();
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
if
(
this
.
strmTrack
[
0
])
{
this
.
setGuiPhoneState
({
this
.
remoteAudio
.
srcObject
=
new
MediaStream
([
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
funcParam
:
{
this
.
strmTrack
[
0
],
bool
:
true
,
callType
:
'
connected
'
,
]);
},
this
.
remoteAudio
.
play
();
});
}
this
.
onSipStateChange
.
innerCallerModal
({
};
bool
:
false
,
type
:
''
,
from
:
''
,
}
});
});
this
.
setGuiPhoneState
({
this
.
callSession
.
on
(
'
confirmed
'
,
()
=>
{
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
true
,
this
.
setGuiPhoneState
({
callType
:
'
incoming
'
,
funcName
:
'
modalState
'
,
funcParam
:
{
},
bool
:
true
,
callType
:
'
connected
'
,
});
},
});
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
true
,
type
:
'
connectingIncoming
'
,
console
.
log
(
'
%c newRTCSession confirmed:
'
,
'
font-size: 22px; color: yellow;
'
,);
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
console
.
log
(
'
%c incoming confirmed
'
,
'
font-size: 22px; color: yellow;
'
,);
});
this
.
onSipStateChange
.
innerCallerModal
({
if
(
this
.
callSession
.
direction
===
'
incoming
'
)
{
bool
:
true
,
type
:
'
connected
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
let
second
;
});
console
.
log
(
'
auto_answer is work:
'
,
this
.
startInnerTimer
();
this
.
globalHistoryData
?.
autoAnswer
,
this
.
setGuiPhoneState
({
);
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
funcParam
:
{
if
(
this
.
globalHistoryData
?.
autoAnswer
)
{
bool
:
true
,
callType
:
'
connected
'
,
switch
(
this
.
globalHistoryData
?.
autoAnswerSecond
)
{
},
case
1
:
});
second
=
1000
;
break
;
case
50
:
});
second
=
5000
;
this
.
callSession
.
on
(
'
ended
'
,
()
=>
{
break
;
console
.
log
(
'
%c newRTCSession ended:
'
,
'
font-size: 22px; color: yellow;
'
,);
case
100
:
// the call has ended
second
=
10000
;
console
.
log
(
'
%c incoming end
'
,
'
font-size: 22px; color: yellow;
'
);
break
;
this
.
onSipStateChange
.
innerCallerModal
({
default
:
bool
:
false
,
type
:
null
,
from
:
''
,
second
=
0
;
});
}
this
.
stopInnerTimer
();
console
.
log
(
'
auto_answer second:
'
,
second
);
this
.
setGuiPhoneState
({
setTimeout
(()
=>
{
funcName
:
'
modalState
'
,
funcParam
:
{
console
.
log
(
'
auto_answer run boxDialer.answerButtonClick()
'
);
bool
:
false
,
callType
:
''
,
this
.
answerButtonClick
();
},
},
second
);
});
}
this
.
closeBxCall
();
this
.
hangupButtonClick
();
this
.
showNotification
(()
=>
{
this
.
removeViExternalCard
();
this
.
answerButtonClick
();
});
});
this
.
callSession
.
on
(
'
failed
'
,
()
=>
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
true
});
// unable to establish the call
this
.
setGuiPhoneState
({
console
.
log
(
'
%c incoming faile
'
,
'
font-size: 22px; color: yellow;
'
,);
funcName
:
'
modalState
'
,
this
.
onSipStateChange
.
innerCallerModal
({
stateCode
:
'
connectingIncoming
'
,
bool
:
false
,
type
:
null
,
funcParam
:
{
});
bool
:
true
,
this
.
stopInnerTimer
();
callType
:
'
incoming
'
,
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
},
this
.
closeBxCall
();
});
this
.
hangupButtonClick
();
this
.
setGuiPhoneState
({
// window.innerCallBegin();
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
this
.
callSession
.
on
(
'
progress
'
,
(
e
)
=>
{
},
console
.
log
(
});
'
%c progress:
'
,
});
'
font-size: 22px; color: yellow;
'
,
this
.
callSession
.
on
(
'
connecting
'
,
(
e
)
=>
{
e
,
console
.
log
(
'
%c connecting:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
);
});
this
.
setGuiPhoneState
({
this
.
callSession
.
on
(
'
sending
'
,
(
e
)
=>
{
stateCode
:
'
incoming
'
,
console
.
log
(
'
%c sending:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
});
});
// incoming call here
this
.
callSession
.
on
(
'
newDTMF
'
,
(
e
)
=>
{
this
.
callSession
.
on
(
'
accepted
'
,
()
=>
{
console
.
log
(
'
%c newDTMF:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
console
.
log
(
});
'
%c newRTCSession accepted:
'
,
this
.
callSession
.
on
(
'
newInfo
'
,
(
e
)
=>
{
'
font-size: 22px; color: yellow;
'
,
console
.
log
(
'
%c newInfo:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
e
,
});
);
this
.
callSession
.
on
(
'
hold
'
,
(
e
)
=>
{
// the call has answered
console
.
log
(
'
%c ___________hold:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
});
this
.
setGuiPhoneState
({
this
.
callSession
.
on
(
'
unhold
'
,
(
e
)
=>
{
funcName
:
'
modalState
'
,
console
.
log
(
'
%c ___________unhold:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
stateCode
:
'
connected
'
,
});
funcParam
:
{
this
.
callSession
.
on
(
'
muted
'
,
(
e
)
=>
{
bool
:
true
,
console
.
log
(
'
%c muted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
callType
:
'
connected
'
,
});
},
this
.
callSession
.
on
(
'
unmuted
'
,
(
e
)
=>
{
});
console
.
log
(
'
%c unmuted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
this
.
onSipStateChange
.
innerCallerModal
({
});
bool
:
false
,
this
.
callSession
.
on
(
'
reinvite
'
,
(
e
)
=>
{
type
:
''
,
console
.
log
(
'
%c reinvite:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
from
:
''
,
});
});
this
.
callSession
.
on
(
'
update
'
,
(
e
)
=>
{
});
console
.
log
(
'
%c update:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
this
.
callSession
.
on
(
'
confirmed
'
,
()
=>
{
});
console
.
log
(
this
.
callSession
.
on
(
'
refer
'
,
(
e
)
=>
{
'
%c newRTCSession confirmed:
'
,
console
.
log
(
'
%c refer:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
'
font-size: 22px; color: yellow;
'
,
});
);
this
.
callSession
.
on
(
'
replaces
'
,
(
e
)
=>
{
// this handler will be called for incoming calls too
console
.
log
(
'
%c replaces:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
console
.
log
(
});
'
%c incoming confirmed
'
,
this
.
callSession
.
on
(
'
sdp
'
,
(
e
)
=>
{
'
font-size: 22px; color: yellow;
'
,
console
.
log
(
'
%c sdp:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
);
});
this
.
onSipStateChange
.
innerCallerModal
({
this
.
callSession
.
on
(
'
icecandidate
'
,
(
e
)
=>
{
bool
:
true
,
console
.
log
(
'
%c icecandidate:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
type
:
'
connected
'
,
});
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
this
.
callSession
.
on
(
'
getusermediafailed
'
,
(
e
)
=>
{
});
console
.
log
(
'
%c getusermediafailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
this
.
startInnerTimer
();
});
this
.
setGuiPhoneState
({
this
.
callSession
.
on
(
'
peerconnection: createofferfailed
'
,
(
e
)
=>
{
funcName
:
'
modalState
'
,
console
.
log
(
'
%c peerconnection: createofferfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
stateCode
:
'
connected
'
,
});
funcParam
:
{
this
.
callSession
.
on
(
'
peerconnection: setlocaldescriptionfailed
'
,
(
e
)
=>
{
bool
:
true
,
console
.
log
(
'
%c peerconnection: setlocaldescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
callType
:
'
connected
'
,
},);
},
this
.
callSession
.
on
(
'
peerconnection: setremotedescriptionfailed
'
,
(
e
)
=>
{
});
console
.
log
(
'
%c peerconnection: setremotedescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
},);
this
.
callSession
.
on
(
'
ended
'
,
()
=>
{
}
console
.
log
(
});
'
%c newRTCSession ended:
'
,
this
.
ua
.
start
();
'
font-size: 22px; color: yellow;
'
,
}
);
}
catch
(
err
)
{
// the call has ended
console
.
log
(
`jsSip_error: `
,
err
);
console
.
log
(
'
%c incoming end
'
,
'
font-size: 22px; color: yellow;
'
);
}
this
.
onSipStateChange
.
innerCallerModal
({
};
bool
:
false
,
type
:
null
,
getBxUiState
(
sipState
)
{
from
:
''
,
// if (sipState && !!sipState.length) sipState = this.sipState;
});
let
uiStates
=
{
this
.
stopInnerTimer
();
incoming
:
'
1
'
,
this
.
setGuiPhoneState
({
transferIncoming
:
'
2
'
,
funcName
:
'
modalState
'
,
outgoing
:
'
3
'
,
funcParam
:
{
connectingIncoming
:
'
4
'
,
bool
:
false
,
connectingOutgoing
:
'
5
'
,
callType
:
''
,
connected
:
'
6
'
,
},
transferring
:
'
7
'
,
});
transferFailed
:
'
8
'
,
this
.
closeBxCall
();
transferConnected
:
'
9
'
,
this
.
hangupButtonClick
();
idle
:
'
10
'
,
this
.
removeViExternalCard
();
error
:
'
11
'
,
});
moneyError
:
'
12
'
,
this
.
callSession
.
on
(
'
failed
'
,
()
=>
{
sipPhoneError
:
'
13
'
,
// unable to establish the call
redial
:
'
14
'
,
console
.
log
(
externalCard
:
'
15
'
,
'
%c incoming faile
'
,
};
'
font-size: 22px; color: yellow;
'
,
console
.
log
(
'
getBxUiState_inset:
'
,
sipState
,
uiStates
[
sipState
]);
);
this
.
sipBxState
=
uiStates
[
sipState
];
this
.
onSipStateChange
.
innerCallerModal
({
return
sipState
&&
uiStates
[
sipState
]
?
uiStates
[
sipState
]
:
''
;
bool
:
false
,
}
type
:
null
,
});
callBxMethods
({
bxMethodName
,
bxFuncParams
,
callback
})
{
this
.
stopInnerTimer
();
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
window
?.
BX24
.
placement
.
call
(
bxMethodName
,
bxFuncParams
,
callback
);
this
.
closeBxCall
();
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
)
{
this
.
hangupButtonClick
();
window
.
alovoicePhone
.
callMethods
[
bxMethodName
](
bxFuncParams
,
callback
);
this
.
setGuiPhoneState
({
}
funcName
:
'
modalState
'
,
if
(
bxFuncParams
.
uiState
==
'
5
'
)
{
funcParam
:
{
this
.
removeViExternalCard
();
bool
:
false
,
}
callType
:
''
,
}
},
});
closeBxCall
()
{
});
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
this
.
callSession
.
on
(
'
connecting
'
,
(
e
)
=>
{
window
?.
BX24
.
placement
.
call
(
'
CallCardClose
'
,
{},
()
=>
{
console
.
log
(
});
'
%c connecting:
'
,
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
&&
window
.
alovoicePhone
.
bodClose
)
{
'
font-size: 22px; color: yellow;
'
,
window
?.
alovoicePhone
?.
bodClose
();
e
,
}
);
}
});
this
.
callSession
.
on
(
'
sending
'
,
(
e
)
=>
{
setGuiPhoneState
({
stateCode
,
funcName
,
funcParam
})
{
console
.
log
(
'
%c sending:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
console
.
log
(
'
boxdialer_setGuiPhoneState_states:
'
,
{
stateCode
,
funcName
,
funcParam
})
});
if
(
window
?.
alovoice_wsphone
&&
!!
stateCode
?.
length
)
{
console
.
log
(
'
this_getBxUiState_stateCode
'
,
stateCode
,
this
.
getBxUiState
(
stateCode
),);
this
.
callSession
.
on
(
'
newDTMF
'
,
(
e
)
=>
{
this
.
callBxMethods
({
console
.
log
(
'
%c newDTMF:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
bxMethodName
:
'
CallCardSetUiState
'
,
});
bxFuncParams
:
{
uiState
:
this
.
getBxUiState
(
stateCode
)},
this
.
callSession
.
on
(
'
newInfo
'
,
(
e
)
=>
{
callback
:
(
e
)
=>
{
console
.
log
(
'
%c newInfo:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
console
.
log
(
e
,
`CallCardSetUiState method done
${
e
}
`
);
});
},
this
.
callSession
.
on
(
'
hold
'
,
(
e
)
=>
{
});
console
.
log
(
}
else
if
(
!
window
?.
alovoice_wsphone
&&
!!
funcName
&&
this
.
onSipStateChange
[
funcName
]
!==
'
undefined
'
&&
!!
funcParam
)
{
'
%c ___________hold:
'
,
console
.
log
(
'
setGuiPhoneState_for_alovoice_cloud_run_command:
'
,
{
'
font-size: 22px; color: yellow;
'
,
stateCode
,
funcName
,
funcParam
,
e
,
},
);
!
window
?.
alovoice_wsphone
,
});
!!
funcName
,
this
.
callSession
.
on
(
'
unhold
'
,
(
e
)
=>
{
this
.
onSipStateChange
[
funcName
]
!==
'
undefined
'
,
console
.
log
(
!!
funcParam
'
%c ___________unhold:
'
,
)
'
font-size: 22px; color: yellow;
'
,
this
.
onSipStateChange
[
funcName
](
funcParam
);
e
,
}
);
}
});
this
.
callSession
.
on
(
'
muted
'
,
(
e
)
=>
{
bxLog
(...
datas
)
{
console
.
log
(
'
%c muted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
console
.
log
(
`%c BXLOG:`
,
datas
,
'
background-color: red;
'
);
});
}
this
.
callSession
.
on
(
'
unmuted
'
,
(
e
)
=>
{
console
.
log
(
'
%c unmuted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
onSessionEvent
({
type
,
event
})
{
});
}
this
.
callSession
.
on
(
'
reinvite
'
,
(
e
)
=>
{
console
.
log
(
selectUser
()
{
'
%c reinvite:
'
,
BX
.
Runtime
.
loadExtension
(
'
ui.entity-selector
'
).
then
((
exports
)
=>
{
'
font-size: 22px; color: yellow;
'
,
const
{
Dialog
,
TagSelector
}
=
exports
;
e
,
);
const
dialog
=
new
BX
.
UI
.
EntitySelector
.
Dialog
({
});
// targetNode: button,
this
.
callSession
.
on
(
'
update
'
,
(
e
)
=>
{
enableSearch
:
true
,
multiple
:
false
,
context
:
'
MY_MODULE_CONTEXT
'
,
entities
:
[{
console
.
log
(
'
%c update:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
id
:
'
user
'
,
// пользователи
});
options
:
{
selectFields
:
[
'
ufPhoneInner
'
]},
this
.
callSession
.
on
(
'
refer
'
,
(
e
)
=>
{
},
{
console
.
log
(
'
%c refer:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
id
:
'
department
'
,
// структура компании: выбор только пользователей
});
},],
events
:
{
this
.
callSession
.
on
(
'
replaces
'
,
(
e
)
=>
{
'
_Item:onSelect
'
:
(
event
)
=>
{
console
.
log
(
const
{
item
}
=
event
.
getData
();
'
%c replaces:
'
,
const
dialog
=
event
.
getTarget
();
'
font-size: 22px; color: yellow;
'
,
const
selectedItems
=
dialog
.
getSelectedItems
();
e
,
);
if
(
item
.
customData
.
get
(
'
ufPhoneInner
'
))
{
});
this
.
transferButtonClick
(
item
.
customData
.
get
(
'
ufPhoneInner
'
));
this
.
callSession
.
on
(
'
sdp
'
,
(
e
)
=>
{
}
console
.
log
(
'
%c sdp:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
},
get
'
Item:onSelect
'
()
{
});
return
this
[
'
_Item:onSelect
'
];
this
.
callSession
.
on
(
'
icecandidate
'
,
(
e
)
=>
{
},
set
'
Item:onSelect
'
(
value
)
{
console
.
log
(
this
[
'
_Item:onSelect
'
]
=
value
;
'
%c icecandidate:
'
,
},
'
font-size: 22px; color: yellow;
'
,
},
e
,
});
);
dialog
.
show
();
});
});
this
.
callSession
.
on
(
'
getusermediafailed
'
,
(
e
)
=>
{
}
console
.
log
(
'
%c getusermediafailed:
'
,
// call_connected;
'
font-size: 22px; color: yellow;
'
,
setSipStateChangeCallback
(
callback
,
funcName
)
{
e
,
this
.
onSipStateChange
[
funcName
]
=
callback
.
bind
(
this
);
);
}
});
this
.
callSession
.
on
(
'
peerconnection: createofferfailed
'
,
(
e
)
=>
{
sipHangUp
()
{
console
.
log
(
console
.
log
(
'
sipHangUp
'
);
'
%c peerconnection: createofferfailed:
'
,
}
'
font-size: 22px; color: yellow;
'
,
e
,
sipUnRegister
()
{
);
console
.
log
(
'
sipUnRegister
'
);
});
}
this
.
callSession
.
on
(
'
peerconnection: setlocaldescriptionfailed
'
,
sipTransfer
()
{
(
e
)
=>
{
console
.
log
(
'
sipTransfer
'
);
console
.
log
(
}
'
%c peerconnection: setlocaldescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
initialized
(
phoneNumber
)
{
e
,
this
.
sipBxState
=
null
;
);
},
this
.
callDirection
=
'
out
'
;
);
let
phoneNumberString
=
phoneNumber
.
toString
();
this
.
callSession
.
on
(
console
.
log
(
'
boxdialer_initialized_param:
'
,
phoneNumber
)
'
peerconnection: setremotedescriptionfailed
'
,
if
(
phoneNumberString
.
length
)
{
(
e
)
=>
{
this
.
onSipStateChange
.
phoneModal
(
false
);
console
.
log
(
this
.
options
.
extraHeaders
=
[
`X-ALOVOICE-EXTNUM:
${
this
.
extnum
}
`
];
'
%c peerconnection: setremotedescriptionfailed:
'
,
this
.
callSession
=
this
.
ua
.
call
(
'
sip:
'
+
phoneNumberString
+
'
@
'
+
this
.
sipDomain
,
this
.
options
,);
'
font-size: 22px; color: yellow;
'
,
}
else
{
e
,
toast
.
error
(
'
Do not correct number
'
,
{
);
style
:
{
},
zIndex
:
'
99999999999999999
'
,
);
},
}
});
});
}
// this.onSipStateChange.phoneModal(false);
this
.
ua
.
start
();
}
}
}
catch
(
err
)
{
skipButtonClick
()
{
console
.
log
(
`jsSip_error: `
,
err
);
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
}
this
.
hangupButtonClick
();
};
}
getBxUiState
(
sipState
)
{
sipSendDTMF
(
code
)
{
// if (sipState && !!sipState.length) sipState = this.sipState;
this
.
callSession
.
sendDTMF
(
code
);
let
uiStates
=
{
}
incoming
:
'
1
'
,
transferIncoming
:
'
2
'
,
addCommentButtonClick
()
{
outgoing
:
'
3
'
,
console
.
log
(
'
addCommentButtonClick
'
);
connectingIncoming
:
'
4
'
,
}
connectingOutgoing
:
'
5
'
,
connected
:
'
6
'
,
muteButtonClick
()
{
transferring
:
'
7
'
,
transferFailed
:
'
8
'
,
let
{
audio
}
=
this
.
callSession
.
isMuted
();
transferConnected
:
'
9
'
,
if
(
audio
)
{
idle
:
'
10
'
,
this
.
callSession
.
unmute
();
error
:
'
11
'
,
console
.
log
(
'
muteButtonClick_unmute
'
);
moneyError
:
'
12
'
,
sipPhoneError
:
'
13
'
,
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
false
});
redial
:
'
14
'
,
}
else
{
externalCard
:
'
15
'
,
this
.
callSession
.
mute
();
};
console
.
log
(
'
muteButtonClick_mute
'
);
console
.
log
(
'
getBxUiState_inset:
'
,
sipState
,
uiStates
[
sipState
]);
this
.
sipBxState
=
uiStates
[
sipState
];
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
true
});
return
sipState
&&
uiStates
[
sipState
]
?
uiStates
[
sipState
]
:
''
;
}
}
}
callBxMethods
({
bxMethodName
,
bxFuncParams
,
callback
})
{
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
answerButtonClick
()
{
window
?.
BX24
.
placement
.
call
(
bxMethodName
,
bxFuncParams
,
callback
);
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
)
{
this
.
callSession
?.
answer
(
this
.
options
);
window
.
alovoicePhone
.
callMethods
[
bxMethodName
](
bxFuncParams
,
callback
);
this
.
callSession
.
connection
.
addEventListener
(
'
addstream
'
,
(
event
)
=>
{
}
this
.
remoteAudio
.
srcObject
=
event
.
stream
;
if
(
bxFuncParams
.
uiState
==
'
5
'
)
{
this
.
remoteAudio
.
play
();
this
.
removeViExternalCard
();
});
}
}
}
closeBxCall
()
{
holdButtonClick
()
{
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
let
{
local
}
=
this
.
callSession
.
isOnHold
();
window
?.
BX24
.
placement
.
call
(
'
CallCardClose
'
,
{},
()
=>
{});
console
.
log
(
'
local:
'
,
local
);
}
else
if
(
if
(
local
)
{
window
.
alovoicePhone
&&
this
.
callSession
.
unhold
();
window
.
alovoicePhone
.
callMethods
&&
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
false
});
window
.
alovoicePhone
.
bodClose
}
else
{
)
{
this
.
callSession
.
hold
();
window
?.
alovoicePhone
?.
bodClose
();
}
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
true
});
}
}
}
setGuiPhoneState
({
stateCode
,
funcName
,
funcParam
})
{
console
.
log
(
'
boxdialer_setGuiPhoneState_states:
'
,
{
stateCode
,
funcName
,
funcParam
})
closeButtonClick
()
{
if
(
window
?.
alovoice_wsphone
&&
!!
stateCode
?.
length
)
{
this
.
hangupButtonClick
();
console
.
log
(
}
'
this_getBxUiState_stateCode
'
,
stateCode
,
hangupButtonClick
()
{
this
.
getBxUiState
(
stateCode
),
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
);
this
.
onSipStateChange
.
innerCallerModal
({
this
.
callBxMethods
({
bool
:
false
,
type
:
null
,
from
:
''
,
bxMethodName
:
'
CallCardSetUiState
'
,
});
bxFuncParams
:
{
uiState
:
this
.
getBxUiState
(
stateCode
)
},
console
.
log
(
'
hangupButtonClick========-----------
'
,
this
.
callSession
.
_status
,);
callback
:
(
e
)
=>
{
if
(
this
.
callSession
&&
this
.
callSession
.
_status
!=
'
8
'
)
this
.
callSession
.
terminate
();
console
.
log
(
e
,
`CallCardSetUiState method done
${
e
}
`
);
}
},
});
transferButtonClick
(
number
)
{
}
else
if
(
this
.
callSession
.
refer
(
number
,
this
.
options
);
!
window
?.
alovoice_wsphone
&&
}
!
stateCode
?.
length
&&
!!
funcName
&&
cancelTransferButtonClick
()
{
this
.
onSipStateChange
[
funcName
]
!==
'
undefined
'
console
.
log
(
'
cancelTransferButtonClick
'
);
)
{
}
this
.
onSipStateChange
[
funcName
](
funcParam
);
}
completeTransferButtonClick
()
{
}
console
.
log
(
'
completeTransferButtonClick
'
);
}
bxLog
(...
datas
)
{
console
.
log
(
`%c BXLOG:`
,
datas
,
'
background-color: red;
'
);
nextButtonClick
()
{
}
console
.
log
(
'
nextButtonClick
'
);
}
onSessionEvent
({
type
,
event
})
{}
entityChanged
()
{
selectUser
()
{
console
.
log
(
'
entityChanged
'
);
BX
.
Runtime
.
loadExtension
(
'
ui.entity-selector
'
).
then
((
exports
)
=>
{
}
const
{
Dialog
,
TagSelector
}
=
exports
;
qualityMeterClick
()
{
const
dialog
=
new
BX
.
UI
.
EntitySelector
.
Dialog
({
console
.
log
(
'
qualityMeterClick
'
);
// targetNode: button,
}
enableSearch
:
true
,
multiple
:
false
,
dialpadButtonClick
(
c
)
{
context
:
'
MY_MODULE_CONTEXT
'
,
console
.
log
(
'
dialpadButtonClick
'
);
entities
:
[
this
.
sipSendDTMF
(
c
);
{
}
id
:
'
user
'
,
// пользователи
options
:
{
selectFields
:
[
'
ufPhoneInner
'
]
},
notifyAdminButtonClick
()
{
},
console
.
log
(
'
notifyAdminButtonClick
'
);
{
}
id
:
'
department
'
,
// структура компании: выбор только пользователей
},
stateLog
(
state
)
{
],
let
stColor
=
state
&&
state
.
slice
(
0
,
4
)
==
'
call
'
?
'
blue
'
:
'
green
'
;
events
:
{
if
(
state
&&
state
.
slice
(
0
,
8
)
==
'
register
'
)
{
'
_Item:onSelect
'
:
(
event
)
=>
{
stColor
=
'
yellow
'
;
const
{
item
}
=
event
.
getData
();
}
const
dialog
=
event
.
getTarget
();
let
css
=
'
color:
'
+
stColor
+
'
; font-size: 20px;
'
;
const
selectedItems
=
dialog
.
getSelectedItems
();
console
.
log
(
'
---onSessionEvent EVENT: %c %s
'
,
css
,
state
);
if
(
item
.
customData
.
get
(
'
ufPhoneInner
'
))
{
}
this
.
transferButtonClick
(
item
.
customData
.
get
(
'
ufPhoneInner
'
));
}
},
get
'
Item:onSelect
'
()
{
return
this
[
'
_Item:onSelect
'
];
},
set
'
Item:onSelect
'
(
value
)
{
this
[
'
_Item:onSelect
'
]
=
value
;
},
},
});
dialog
.
show
();
});
}
// call_connected;
setSipStateChangeCallback
(
callback
,
funcName
)
{
this
.
onSipStateChange
[
funcName
]
=
callback
.
bind
(
this
);
}
sipHangUp
()
{
console
.
log
(
'
sipHangUp
'
);
}
sipUnRegister
()
{
console
.
log
(
'
sipUnRegister
'
);
}
sipTransfer
()
{
console
.
log
(
'
sipTransfer
'
);
}
initialized
(
phoneNumber
)
{
this
.
sipBxState
=
null
;
this
.
callDirection
=
'
out
'
;
let
phoneNumberString
=
phoneNumber
.
toString
();
if
(
phoneNumberString
.
length
)
{
this
.
onSipStateChange
.
phoneModal
(
false
);
this
.
options
.
extraHeaders
=
[
`X-ALOVOICE-EXTNUM:
${
this
.
extnum
}
`
];
this
.
callSession
=
this
.
ua
.
call
(
'
sip:
'
+
phoneNumberString
+
'
@
'
+
this
.
sipDomain
,
this
.
options
,
);
// this.callSession.connection.addEventListener('addstream', (event) => {
// console.log('--== ss OUT STREAM: ');
// this.remoteAudio.srcObject = event.stream;
// this.remoteAudio.play();
// });
}
else
{
toast
.
error
(
'
Do not correct number
'
,
{
style
:
{
zIndex
:
'
99999999999999999
'
,
},
});
}
// this.onSipStateChange.phoneModal(false);
}
skipButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
hangupButtonClick
();
}
sipSendDTMF
(
code
)
{
this
.
callSession
.
sendDTMF
(
code
);
}
addCommentButtonClick
()
{
console
.
log
(
'
addCommentButtonClick
'
);
}
muteButtonClick
()
{
let
{
audio
}
=
this
.
callSession
.
isMuted
();
if
(
audio
)
{
this
.
callSession
.
unmute
();
console
.
log
(
'
muteButtonClick_unmute
'
);
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
false
});
}
else
{
this
.
callSession
.
mute
();
console
.
log
(
'
muteButtonClick_mute
'
);
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
true
});
}
}
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
();
});
}
holdButtonClick
()
{
let
{
local
}
=
this
.
callSession
.
isOnHold
();
console
.
log
(
'
local:
'
,
local
);
if
(
local
)
{
this
.
callSession
.
unhold
();
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
false
});
}
else
{
this
.
callSession
.
hold
();
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
true
});
}
}
closeButtonClick
()
{
this
.
hangupButtonClick
();
}
hangupButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
null
,
from
:
''
,
});
console
.
log
(
'
hangupButtonClick========-----------
'
,
this
.
callSession
.
_status
,
);
if
(
this
.
callSession
&&
this
.
callSession
.
_status
!=
'
8
'
)
this
.
callSession
.
terminate
();
}
transferButtonClick
(
number
)
{
this
.
callSession
.
refer
(
number
,
this
.
options
);
}
cancelTransferButtonClick
()
{
console
.
log
(
'
cancelTransferButtonClick
'
);
}
completeTransferButtonClick
()
{
console
.
log
(
'
completeTransferButtonClick
'
);
}
nextButtonClick
()
{
console
.
log
(
'
nextButtonClick
'
);
}
entityChanged
()
{
console
.
log
(
'
entityChanged
'
);
}
qualityMeterClick
()
{
console
.
log
(
'
qualityMeterClick
'
);
}
dialpadButtonClick
(
c
)
{
console
.
log
(
'
dialpadButtonClick
'
);
this
.
sipSendDTMF
(
c
);
}
notifyAdminButtonClick
()
{
console
.
log
(
'
notifyAdminButtonClick
'
);
}
stateLog
(
state
)
{
let
stColor
=
state
&&
state
.
slice
(
0
,
4
)
==
'
call
'
?
'
blue
'
:
'
green
'
;
if
(
state
&&
state
.
slice
(
0
,
8
)
==
'
register
'
)
{
stColor
=
'
yellow
'
;
}
let
css
=
'
color:
'
+
stColor
+
'
; font-size: 20px;
'
;
console
.
log
(
'
---onSessionEvent EVENT: %c %s
'
,
css
,
state
);
}
}
}
src/root/index.jsx
View file @
41c692c1
...
@@ -11,7 +11,6 @@ import InnerCaller from '../components/InnerCaller';
...
@@ -11,7 +11,6 @@ import InnerCaller from '../components/InnerCaller';
import
{
useConfigHoldMute
}
from
"
../storage
"
import
{
useConfigHoldMute
}
from
"
../storage
"
import
SettingComponent
from
"
../components/setting
"
import
SettingComponent
from
"
../components/setting
"
import
{
useColorConfig
}
from
"
../storage/globalColorConfig
"
import
{
useColorConfig
}
from
"
../storage/globalColorConfig
"
// import { contextModalEventProperty } from '../context/modalEventProperty';
const
Root
=
({
wsphonedata
,
onSetDnd
,
setWsphonedata
,
callMethod
})
=>
{
const
Root
=
({
wsphonedata
,
onSetDnd
,
setWsphonedata
,
callMethod
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
const
boxDialer
=
window
.
BoxDialer
;
...
@@ -178,14 +177,6 @@ const Root = ({wsphonedata, onSetDnd, setWsphonedata, callMethod}) => {
...
@@ -178,14 +177,6 @@ const Root = ({wsphonedata, onSetDnd, setWsphonedata, callMethod}) => {
extnums=
{
wsphonedata
.
extnums
}
extnums=
{
wsphonedata
.
extnums
}
/>
/>
{
/*
incoming
outgoing
connectingIncoming
connectingOutgoing
connected
*/
}
<
Modal
<
Modal
className=
'tailwindGlobalCss'
className=
'tailwindGlobalCss'
hidden=
{
modalState
.
bool
}
hidden=
{
modalState
.
bool
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment