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
Show 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 = ({
.
scrollTo
(
document
.
getElementById
(
'
numbersDiv
'
).
scrollWidth
,
0
);
},
[
inputValue
]);
console
.
log
(
'
input_modal:
'
,
modal
,
numberSelectHistory
);
document
.
querySelector
(
'
body
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
if
(
modal
)
setModal
(
false
);
});
...
...
src/components/Modal/index.jsx
View file @
41c692c1
...
...
@@ -13,7 +13,6 @@ import DialpadIcon from '@mui/icons-material/Dialpad';
import
CallCardDropDown
from
'
../CallCardDropDown
'
;
import
ModalNumpad
from
'
../ModalNumpad
'
;
import
{
useConfigHoldMute
}
from
"
../../storage
"
// import { contextModalEventProperty } from '../../context/modalEventProperty';
const
Modal
=
({
children
,
hidden
,
hangupButton
,
phoneNumber
,
callType
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
...
...
@@ -24,7 +23,6 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
const
[
transferModel
,
setTransferModel
]
=
useState
(
true
);
const
[
numpadModal
,
setNumpadModal
]
=
useState
(
false
);
console
.
log
(
'
callType_modal:
'
,
callType
)
useEffect
(()
=>
{
setModalHidden
(
hidden
);
...
...
@@ -172,11 +170,6 @@ const Modal = ({ children, hidden, hangupButton, phoneNumber, callType }) => {
<
div
className=
'round'
></
div
>
<
p
className=
'name'
>
No name
</
p
>
</
ModalContainer
.
Head
>
{
/* <hr />
<ModalContainer.Body rollUp={rollUp}></ModalContainer.Body>
<hr />
<ModalContainer.Bottom rollUp={rollUp}></ModalContainer.Bottom>
<hr /> */
}
{
selectModalType
(
callType
)
}
</
ModalContainer
>
<
div
className=
'rollUpVesion'
>
...
...
src/components/ModalPhoneNumpad/index.jsx
View file @
41c692c1
...
...
@@ -186,9 +186,7 @@ const ModalPhoneNumpad = ({
},
[
handleKeyUp
]);
// `${Data.getHours()}:${Data.getMinutes()} ${Data.getDate()}.${Data.getMonth()+1}.${Data.getFullYear()}`
const
callButton
=
()
=>
{
// inset if ----------
// -------------------
var
currentTime
=
new
Date
();
if
(
dynamicValue
===
'
connected
'
)
{
if
(
...
...
@@ -196,8 +194,7 @@ const ModalPhoneNumpad = ({
call_history
.
slice
(
-
1
)[
0
]?.
value
!=
inputValue
)
{
let
newCallsStringify
=
JSON
.
stringify
([
...
call_history
,
{
...
call_history
,
{
value
:
inputValue
,
time
:
`
${
currentTime
.
getHours
()}
:
${
currentTime
.
getMinutes
()}
${
currentTime
.
getDate
()}
.
${
currentTime
.
getMonth
()}
.
${
currentTime
.
getFullYear
()}
`
,
},
...
...
@@ -213,6 +210,7 @@ const ModalPhoneNumpad = ({
},
});
}
};
const
selectFunc
=
(
e
)
=>
{
setInputValue
(
e
);
...
...
@@ -287,7 +285,6 @@ const ModalPhoneNumpad = ({
<
p
className=
'call_text'
>
{
translator
.
translate
(
'
CALL
'
)
}
</
p
>
</
div
>
<
div
className=
'right'
onClick=
{
()
=>
setExNum
(
!
exNum
)
}
>
{
/* <KeyboardControlKeyIcon className='icon' /> */
}
<
div
className=
'icon'
></
div
>
</
div
>
</
NumberButton
.
CallButton
>
...
...
@@ -310,10 +307,6 @@ const ModalPhoneNumpad = ({
))
}
</
NumberButton
.
CallButtonModalInset
>
</
NumberButton
.
CallButtonModal
>
{
/* <ModalPhoneNumpadStyle.Window
visiblevalue={exNum}
onClick={() => setExNum(false)}
/> */
}
</
NumberButton
>
</>
)
:
(
...
...
src/components/ModalPhoneNumpad/style.js
View file @
41c692c1
...
...
@@ -17,7 +17,6 @@ const ModalPhoneNumpadStyle = styled.div`
bottom: 120px;
transition:
${({
switchAnim
})
=>
typeof
switchAnim
!==
'
undefined
'
?
(
switchAnim
?
'
0.2s
'
:
'
0s
'
)
:
'
0.2s
'
}
;
${({
switchAnim
})
=>
console
.
log
(
'
switchAnim:
'
,
switchAnim
)}
z-index: 9999;
${({
hiddenValue
,
position
,
variant
})
=>
hiddenValue
...
...
src/components/setting/index.jsx
View file @
41c692c1
...
...
@@ -32,8 +32,6 @@ const SettingComponent = ({
setSettingPage
(
count
)
}
console
.
log
(
'
elem:
'
,
elem
)
useEffect
(()
=>
{
console
.
log
(
'
settingPage:
'
,
settingPage
)
if
(
elem
){
...
...
src/components/settingComponents/fixComponent/index.jsx
View file @
41c692c1
...
...
@@ -10,8 +10,6 @@ const FixComponent = () => {
const
useColorConfigStore
=
useColorConfig
((
store
)
=>
store
)
console
.
log
(
'
useColorConfig client:
'
,
useColorConfigStore
.
state
.
autoAnswer
)
const
marks
=
[
{
value
:
1
,
...
...
src/lib/boxDIaler.js
View file @
41c692c1
/** @format */
import
{
toast
}
from
'
react-hot-toast
'
;
import
{
toast
}
from
'
react-hot-toast
'
;
import
outcomingringTone
from
'
../sounds/ringtone.wav
'
;
import
waitRingTone
from
'
../sounds/ringbacktone.wav
'
;
import
pickSound
from
'
../sounds/dtmf.wav
'
;
import
{
WebSocketInterface
,
UA
}
from
'
jssip
'
;
import
{
WebSocketInterface
,
UA
}
from
'
jssip
'
;
import
tugpng
from
'
../img/tug.png
'
;
import
packageJson
from
'
../../package.json
'
;
...
...
@@ -43,12 +43,10 @@ export class BoxDialer {
oscillator2
;
extnum
;
timer
=
{
time
:
0
,
type
:
null
,
time
:
0
,
type
:
null
,
};
innerTimer
=
{
time
:
0
,
type
:
null
,
time
:
0
,
type
:
null
,
};
options
;
socket
;
...
...
@@ -85,13 +83,11 @@ export class BoxDialer {
this
.
waitRingTone
.
loop
=
true
;
this
.
callEvetsBoxDialer
=
{
callHold
:
false
,
callMute
:
null
,
callHold
:
false
,
callMute
:
null
,
};
this
.
options
=
{
eventHandlers
:
this
.
uaEvents
(),
mediaConstraints
:
{
audio
:
true
,
video
:
false
},
eventHandlers
:
this
.
uaEvents
(),
mediaConstraints
:
{
audio
:
true
,
video
:
false
},
};
}
...
...
@@ -160,35 +156,22 @@ export class BoxDialer {
return
{
progress
:
(
e
)
=>
{
console
.
log
(
'
%c progress
'
,
'
font-size: 22px; color: green;
'
,
e
);
// this.hangupButtonClick();
// this.closeBxCall();
// window.innerCallBegin(true);
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
true
,
type
:
'
connectingOutgoing
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
bool
:
true
,
type
:
'
connectingOutgoing
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
});
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
stateCode
:
'
connectingOutgoing
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
funcName
:
'
modalState
'
,
stateCode
:
'
connectingOutgoing
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
},
});
},
failed
:
(
e
)
=>
{
},
failed
:
(
e
)
=>
{
console
.
log
(
'
%c failed
'
,
'
font-size: 22px; color: green;
'
,
e
);
if
(
e
?.
cause
)
{
toast
.
error
(
e
?.
cause
);
}
// console.log('call failed with cause: ' + e.data);
this
.
closeBxCall
();
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
null
,
from
:
''
,
bool
:
false
,
type
:
null
,
from
:
''
,
});
this
.
stopInnerTimer
();
if
(
e
.
cause
==
'
User Denied Media Access
'
)
{
...
...
@@ -200,45 +183,30 @@ export class BoxDialer {
});
window
.
navigator
.
mediaDevices
.
getUserMedia
({
audio
:
true
})
.
getUserMedia
({
audio
:
true
})
.
then
(
function
(
stream
)
{
console
.
log
(
'
User_Danied_Media_Access
'
,
'
You let me use your mic!
'
,
);
console
.
log
(
'
User_Danied_Media_Access
'
,
'
You let me use your mic!
'
,);
})
.
catch
(
function
(
err
)
{
console
.
log
(
'
User_Danied_Media_Access
'
,
'
No mic for you!
'
);
});
}
},
ended
:
(
e
)
=>
{
},
ended
:
(
e
)
=>
{
console
.
log
(
'
%c ended
'
,
'
font-size: 22px; color: green;
'
);
this
.
closeBxCall
();
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
null
,
from
:
''
,
bool
:
false
,
type
:
null
,
from
:
''
,
});
this
.
stopInnerTimer
();
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
},
});
this
.
removeViExternalCard
();
},
confirmed
:
(
e
)
=>
{
},
confirmed
:
(
e
)
=>
{
console
.
log
(
'
%c confirmed
'
,
'
font-size: 22px; color: green;
'
,
e
);
// console.log(`%c BXLOG:`, datas, 'background-color: red;');
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
true
,
type
:
'
connected
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
});
this
.
startInnerTimer
();
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
...
...
@@ -248,16 +216,21 @@ export class BoxDialer {
callFromName
:
'
Test
'
,
},
});
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
true
,
type
:
'
connected
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
});
this
.
startInnerTimer
();
},
};
}
isUaRunning
()
{
return
(
Boolean
(
typeof
window
.
BX
!==
'
undefined
'
)
&&
Boolean
(
window
.
localStorage
.
getItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
))
&&
Boolean
(
window
.
localStorage
.
getItem
(
'
mycall
'
))
);
return
(
Boolean
(
typeof
window
.
BX
!==
'
undefined
'
)
&&
Boolean
(
window
.
localStorage
.
getItem
(
BX
.
bitrix_sessid
()
+
'
_mycall
'
))
&&
Boolean
(
window
.
localStorage
.
getItem
(
'
mycall
'
)));
}
removeViExternalCard
()
{
...
...
@@ -301,13 +274,12 @@ export class BoxDialer {
showNotification
(
cbk
)
{
let
callerId
=
this
.
callSession
.
_remote_identity
.
_uri
.
user
;
const
greeting
=
new
Notification
(
`Звонок от
${
callerId
}
`
,
{
body
:
'
Answer Call
'
,
icon
:
tugpng
,
body
:
'
Answer Call
'
,
icon
:
tugpng
,
});
greeting
.
addEventListener
(
'
click
'
,
cbk
);
}
onSoundType
({
type
,
bool
})
{
onSoundType
({
type
,
bool
})
{
this
.
ringtone
.
remove
();
this
.
waitRingTone
.
remove
();
this
.
pickSound
.
remove
();
...
...
@@ -354,14 +326,13 @@ export class BoxDialer {
}
}
sipRegister
=
({
number
,
secret
,
wsurl
,
isIce
})
=>
{
sipRegister
=
({
number
,
secret
,
wsurl
,
isIce
})
=>
{
try
{
if
(
window
?.
alovoice_setversion
&&
packageJson
?.
version
)
{
window
.
alovoice_setversion
(
packageJson
?.
version
);
}
if
(
this
.
options
)
{
if
(
typeof
BX
!==
'
undefined
'
)
BX
?.
localStorage
?.
remove
(
'
viExternalCard
'
);
if
(
typeof
BX
!==
'
undefined
'
)
BX
?.
localStorage
?.
remove
(
'
viExternalCard
'
);
this
.
socket
=
new
WebSocketInterface
(
`wss://
${
wsurl
}
/ws`
);
this
.
callSession
=
false
;
...
...
@@ -380,67 +351,35 @@ export class BoxDialer {
register_expires
:
60
,
});
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
,
);
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
,);
}
this
.
ua
.
on
(
'
connected
'
,
(
e
)
=>
{
console
.
log
(
'
%c sip_register [connected]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c sip_register [connected]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
ua
.
on
(
'
disconnected
'
,
(
e
)
=>
{
this
.
onSipStateChange
.
dynamicValue
(
'
pending
'
);
console
.
log
(
'
%c sip_register [disconnected]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c sip_register [disconnected]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
ua
.
on
(
'
registered
'
,
(
e
)
=>
{
this
.
onSipStateChange
.
dynamicValue
(
'
connected
'
);
console
.
log
(
'
%c sip_register [registered]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c sip_register [registered]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
ua
.
on
(
'
unregistered
'
,
(
e
)
=>
{
console
.
log
(
'
%c sip_register [unregistered]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c sip_register [unregistered]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
ua
.
on
(
'
registrationFailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c sip_register [registrationFailed]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c sip_register [registrationFailed]:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
ua
.
on
(
'
connecting
'
,
(
e
)
=>
{
console
.
log
(
'
%c connecting:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
this
.
ua
.
on
(
'
registrationExpiring
'
,
(
e
)
=>
{
console
.
log
(
'
%c registrationExpiring:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c registrationExpiring:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
this
.
ua
.
register
();
});
this
.
ua
.
on
(
'
newMessage
'
,
(
e
)
=>
{
...
...
@@ -454,45 +393,33 @@ export class BoxDialer {
});
this
.
ua
.
on
(
'
newRTCSession
'
,
(
data
)
=>
{
console
.
log
(
'
%c newRTCSession:
'
,
'
font-size: 22px; color: yellow;
'
,
data
,
);
console
.
log
(
'
%c newRTCSession:
'
,
'
font-size: 22px; color: yellow;
'
,
data
,);
this
.
callSession
=
data
.
session
;
if
(
this
.
callSession
&&
this
.
callSession
.
connection
)
{
this
.
callSession
.
connection
.
onaddstream
=
(
e
)
=>
{
this
.
strmTrack
=
e
.
stream
.
getAudioTracks
();
if
(
this
.
strmTrack
[
0
])
{
this
.
remoteAudio
.
srcObject
=
new
MediaStream
([
this
.
strmTrack
[
0
],
]);
this
.
remoteAudio
.
srcObject
=
new
MediaStream
([
this
.
strmTrack
[
0
],]);
this
.
remoteAudio
.
play
();
}
};
}
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
incoming
'
,
},
});
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
true
,
type
:
'
connectingIncoming
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
bool
:
true
,
type
:
'
connectingIncoming
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
});
if
(
this
.
callSession
.
direction
===
'
incoming
'
)
{
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
incoming
'
,
},
});
let
second
;
console
.
log
(
'
auto_answer is work:
'
,
this
.
globalHistoryData
?.
autoAnswer
,
);
console
.
log
(
'
auto_answer is work:
'
,
this
.
globalHistoryData
?.
autoAnswer
,);
if
(
this
.
globalHistoryData
?.
autoAnswer
)
{
switch
(
this
.
globalHistoryData
?.
autoAnswerSecond
)
{
case
1
:
...
...
@@ -517,94 +444,72 @@ export class BoxDialer {
this
.
showNotification
(()
=>
{
this
.
answerButtonClick
();
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
true
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
true
});
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
stateCode
:
'
connectingIncoming
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
incoming
'
,
funcName
:
'
modalState
'
,
stateCode
:
'
connectingIncoming
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
incoming
'
,
},
});
// window.innerCallBegin();
this
.
callSession
.
on
(
'
progress
'
,
(
e
)
=>
{
console
.
log
(
'
%c progress:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c progress:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
this
.
setGuiPhoneState
({
stateCode
:
'
incoming
'
,
});
});
// incoming call here
this
.
callSession
.
on
(
'
accepted
'
,
()
=>
{
console
.
log
(
'
%c newRTCSession accepted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c newRTCSession accepted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
// the call has answered
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
connected
'
,
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
connected
'
,
},
});
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
''
,
from
:
''
,
bool
:
false
,
type
:
''
,
from
:
''
,
});
});
this
.
callSession
.
on
(
'
confirmed
'
,
()
=>
{
console
.
log
(
'
%c newRTCSession confirmed:
'
,
'
font-size: 22px; color: yellow;
'
,
);
// this handler will be called for incoming calls too
console
.
log
(
'
%c incoming confirmed
'
,
'
font-size: 22px; color: yellow;
'
,
);
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
connected
'
,
},
});
console
.
log
(
'
%c newRTCSession confirmed:
'
,
'
font-size: 22px; color: yellow;
'
,);
console
.
log
(
'
%c incoming confirmed
'
,
'
font-size: 22px; color: yellow;
'
,);
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
true
,
type
:
'
connected
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
bool
:
true
,
type
:
'
connected
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
});
this
.
startInnerTimer
();
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
connected
'
,
funcName
:
'
modalState
'
,
stateCode
:
'
connected
'
,
funcParam
:
{
bool
:
true
,
callType
:
'
connected
'
,
},
});
});
this
.
callSession
.
on
(
'
ended
'
,
()
=>
{
console
.
log
(
'
%c newRTCSession ended:
'
,
'
font-size: 22px; color: yellow;
'
,
);
console
.
log
(
'
%c newRTCSession ended:
'
,
'
font-size: 22px; color: yellow;
'
,);
// the call has ended
console
.
log
(
'
%c incoming end
'
,
'
font-size: 22px; color: yellow;
'
);
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
null
,
from
:
''
,
bool
:
false
,
type
:
null
,
from
:
''
,
});
this
.
stopInnerTimer
();
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
},
});
this
.
closeBxCall
();
...
...
@@ -613,32 +518,22 @@ export class BoxDialer {
});
this
.
callSession
.
on
(
'
failed
'
,
()
=>
{
// unable to establish the call
console
.
log
(
'
%c incoming faile
'
,
'
font-size: 22px; color: yellow;
'
,
);
console
.
log
(
'
%c incoming faile
'
,
'
font-size: 22px; color: yellow;
'
,);
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
null
,
bool
:
false
,
type
:
null
,
});
this
.
stopInnerTimer
();
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
closeBxCall
();
this
.
hangupButtonClick
();
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
funcName
:
'
modalState
'
,
funcParam
:
{
bool
:
false
,
callType
:
''
,
},
});
});
this
.
callSession
.
on
(
'
connecting
'
,
(
e
)
=>
{
console
.
log
(
'
%c connecting:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c connecting:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
sending
'
,
(
e
)
=>
{
console
.
log
(
'
%c sending:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
...
...
@@ -651,18 +546,10 @@ export class BoxDialer {
console
.
log
(
'
%c newInfo:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
this
.
callSession
.
on
(
'
hold
'
,
(
e
)
=>
{
console
.
log
(
'
%c ___________hold:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c ___________hold:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
unhold
'
,
(
e
)
=>
{
console
.
log
(
'
%c ___________unhold:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c ___________unhold:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
muted
'
,
(
e
)
=>
{
console
.
log
(
'
%c muted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
...
...
@@ -671,11 +558,7 @@ export class BoxDialer {
console
.
log
(
'
%c unmuted:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
this
.
callSession
.
on
(
'
reinvite
'
,
(
e
)
=>
{
console
.
log
(
'
%c reinvite:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c reinvite:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
update
'
,
(
e
)
=>
{
console
.
log
(
'
%c update:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
...
...
@@ -684,59 +567,28 @@ export class BoxDialer {
console
.
log
(
'
%c refer:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
this
.
callSession
.
on
(
'
replaces
'
,
(
e
)
=>
{
console
.
log
(
'
%c replaces:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c replaces:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
sdp
'
,
(
e
)
=>
{
console
.
log
(
'
%c sdp:
'
,
'
font-size: 22px; color: yellow;
'
,
e
);
});
this
.
callSession
.
on
(
'
icecandidate
'
,
(
e
)
=>
{
console
.
log
(
'
%c icecandidate:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c icecandidate:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
getusermediafailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c getusermediafailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
console
.
log
(
'
%c getusermediafailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
peerconnection: createofferfailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c peerconnection: createofferfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
});
this
.
callSession
.
on
(
'
peerconnection: setlocaldescriptionfailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c peerconnection: setlocaldescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
},
);
this
.
callSession
.
on
(
'
peerconnection: setremotedescriptionfailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c peerconnection: setremotedescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,
);
},
);
console
.
log
(
'
%c peerconnection: createofferfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
});
this
.
callSession
.
on
(
'
peerconnection: setlocaldescriptionfailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c peerconnection: setlocaldescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
},);
this
.
callSession
.
on
(
'
peerconnection: setremotedescriptionfailed
'
,
(
e
)
=>
{
console
.
log
(
'
%c peerconnection: setremotedescriptionfailed:
'
,
'
font-size: 22px; color: yellow;
'
,
e
,);
},);
}
});
this
.
ua
.
start
();
}
}
catch
(
err
)
{
...
...
@@ -768,7 +620,7 @@ export class BoxDialer {
return
sipState
&&
uiStates
[
sipState
]
?
uiStates
[
sipState
]
:
''
;
}
callBxMethods
({
bxMethodName
,
bxFuncParams
,
callback
})
{
callBxMethods
({
bxMethodName
,
bxFuncParams
,
callback
})
{
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
window
?.
BX24
.
placement
.
call
(
bxMethodName
,
bxFuncParams
,
callback
);
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
)
{
...
...
@@ -781,37 +633,33 @@ export class BoxDialer {
closeBxCall
()
{
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
window
?.
BX24
.
placement
.
call
(
'
CallCardClose
'
,
{},
()
=>
{});
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
&&
window
.
alovoicePhone
.
bodClose
)
{
window
?.
BX24
.
placement
.
call
(
'
CallCardClose
'
,
{},
()
=>
{
});
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
&&
window
.
alovoicePhone
.
bodClose
)
{
window
?.
alovoicePhone
?.
bodClose
();
}
}
setGuiPhoneState
({
stateCode
,
funcName
,
funcParam
})
{
console
.
log
(
'
boxdialer_setGuiPhoneState_states:
'
,
{
stateCode
,
funcName
,
funcParam
})
setGuiPhoneState
({
stateCode
,
funcName
,
funcParam
})
{
console
.
log
(
'
boxdialer_setGuiPhoneState_states:
'
,
{
stateCode
,
funcName
,
funcParam
})
if
(
window
?.
alovoice_wsphone
&&
!!
stateCode
?.
length
)
{
console
.
log
(
'
this_getBxUiState_stateCode
'
,
stateCode
,
this
.
getBxUiState
(
stateCode
),
);
console
.
log
(
'
this_getBxUiState_stateCode
'
,
stateCode
,
this
.
getBxUiState
(
stateCode
),);
this
.
callBxMethods
({
bxMethodName
:
'
CallCardSetUiState
'
,
bxFuncParams
:
{
uiState
:
this
.
getBxUiState
(
stateCode
)
},
bxFuncParams
:
{
uiState
:
this
.
getBxUiState
(
stateCode
)
},
callback
:
(
e
)
=>
{
console
.
log
(
e
,
`CallCardSetUiState method done
${
e
}
`
);
},
});
}
else
if
(
!
window
?.
alovoice_wsphone
&&
!
stateCode
?.
length
&&
!!
funcName
&&
this
.
onSipStateChange
[
funcName
]
!==
'
undefined
'
)
{
}
else
if
(
!
window
?.
alovoice_wsphone
&&
!!
funcName
&&
this
.
onSipStateChange
[
funcName
]
!==
'
undefined
'
&&
!!
funcParam
)
{
console
.
log
(
'
setGuiPhoneState_for_alovoice_cloud_run_command:
'
,
{
stateCode
,
funcName
,
funcParam
,
},
!
window
?.
alovoice_wsphone
,
!!
funcName
,
this
.
onSipStateChange
[
funcName
]
!==
'
undefined
'
,
!!
funcParam
)
this
.
onSipStateChange
[
funcName
](
funcParam
);
}
}
...
...
@@ -820,40 +668,32 @@ export class BoxDialer {
console
.
log
(
`%c BXLOG:`
,
datas
,
'
background-color: red;
'
);
}
onSessionEvent
({
type
,
event
})
{}
onSessionEvent
({
type
,
event
})
{
}
selectUser
()
{
BX
.
Runtime
.
loadExtension
(
'
ui.entity-selector
'
).
then
((
exports
)
=>
{
const
{
Dialog
,
TagSelector
}
=
exports
;
const
{
Dialog
,
TagSelector
}
=
exports
;
const
dialog
=
new
BX
.
UI
.
EntitySelector
.
Dialog
({
// targetNode: button,
enableSearch
:
true
,
multiple
:
false
,
context
:
'
MY_MODULE_CONTEXT
'
,
entities
:
[
{
enableSearch
:
true
,
multiple
:
false
,
context
:
'
MY_MODULE_CONTEXT
'
,
entities
:
[{
id
:
'
user
'
,
// пользователи
options
:
{
selectFields
:
[
'
ufPhoneInner
'
]
},
},
{
options
:
{
selectFields
:
[
'
ufPhoneInner
'
]},
},
{
id
:
'
department
'
,
// структура компании: выбор только пользователей
},
],
events
:
{
},],
events
:
{
'
_Item:onSelect
'
:
(
event
)
=>
{
const
{
item
}
=
event
.
getData
();
const
{
item
}
=
event
.
getData
();
const
dialog
=
event
.
getTarget
();
const
selectedItems
=
dialog
.
getSelectedItems
();
if
(
item
.
customData
.
get
(
'
ufPhoneInner
'
))
{
this
.
transferButtonClick
(
item
.
customData
.
get
(
'
ufPhoneInner
'
));
}
},
get
'
Item:onSelect
'
()
{
},
get
'
Item:onSelect
'
()
{
return
this
[
'
_Item:onSelect
'
];
},
set
'
Item:onSelect
'
(
value
)
{
},
set
'
Item:onSelect
'
(
value
)
{
this
[
'
_Item:onSelect
'
]
=
value
;
},
},
...
...
@@ -862,7 +702,7 @@ export class BoxDialer {
});
}
// call_connected;
// call_connected;
setSipStateChangeCallback
(
callback
,
funcName
)
{
this
.
onSipStateChange
[
funcName
]
=
callback
.
bind
(
this
);
}
...
...
@@ -884,19 +724,11 @@ export class BoxDialer {
this
.
callDirection
=
'
out
'
;
let
phoneNumberString
=
phoneNumber
.
toString
();
console
.
log
(
'
boxdialer_initialized_param:
'
,
phoneNumber
)
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();
// });
this
.
callSession
=
this
.
ua
.
call
(
'
sip:
'
+
phoneNumberString
+
'
@
'
+
this
.
sipDomain
,
this
.
options
,);
}
else
{
toast
.
error
(
'
Do not correct number
'
,
{
style
:
{
...
...
@@ -908,7 +740,7 @@ export class BoxDialer {
}
skipButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
hangupButtonClick
();
}
...
...
@@ -922,17 +754,17 @@ export class BoxDialer {
muteButtonClick
()
{
let
{
audio
}
=
this
.
callSession
.
isMuted
();
let
{
audio
}
=
this
.
callSession
.
isMuted
();
if
(
audio
)
{
this
.
callSession
.
unmute
();
console
.
log
(
'
muteButtonClick_unmute
'
);
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
false
});
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
false
});
}
else
{
this
.
callSession
.
mute
();
console
.
log
(
'
muteButtonClick_mute
'
);
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
true
});
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callMute
:
true
});
}
}
...
...
@@ -948,15 +780,15 @@ export class BoxDialer {
holdButtonClick
()
{
let
{
local
}
=
this
.
callSession
.
isOnHold
();
let
{
local
}
=
this
.
callSession
.
isOnHold
();
console
.
log
(
'
local:
'
,
local
);
if
(
local
)
{
this
.
callSession
.
unhold
();
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
false
});
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
false
});
}
else
{
this
.
callSession
.
hold
();
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
true
});
this
.
onSipStateChange
[
'
setCallEvents
'
]({
callHold
:
true
});
}
}
...
...
@@ -965,18 +797,12 @@ export class BoxDialer {
}
hangupButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
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
();
bool
:
false
,
type
:
null
,
from
:
''
,
});
console
.
log
(
'
hangupButtonClick========-----------
'
,
this
.
callSession
.
_status
,);
if
(
this
.
callSession
&&
this
.
callSession
.
_status
!=
'
8
'
)
this
.
callSession
.
terminate
();
}
transferButtonClick
(
number
)
{
...
...
src/root/index.jsx
View file @
41c692c1
...
...
@@ -11,7 +11,6 @@ import InnerCaller from '../components/InnerCaller';
import
{
useConfigHoldMute
}
from
"
../storage
"
import
SettingComponent
from
"
../components/setting
"
import
{
useColorConfig
}
from
"
../storage/globalColorConfig
"
// import { contextModalEventProperty } from '../context/modalEventProperty';
const
Root
=
({
wsphonedata
,
onSetDnd
,
setWsphonedata
,
callMethod
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
...
...
@@ -178,14 +177,6 @@ const Root = ({wsphonedata, onSetDnd, setWsphonedata, callMethod}) => {
extnums=
{
wsphonedata
.
extnums
}
/>
{
/*
incoming
outgoing
connectingIncoming
connectingOutgoing
connected
*/
}
<
Modal
className=
'tailwindGlobalCss'
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