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
9b62f42b
Commit
9b62f42b
authored
Nov 10, 2023
by
Muhammadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update-
parent
4a51d89e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1020 additions
and
993 deletions
+1020
-993
package.json
package.json
+1
-1
boxDIaler.js
src/lib/boxDIaler.js
+1011
-964
index.jsx
src/root/index.jsx
+8
-28
No files found.
package.json
View file @
9b62f42b
{
"name"
:
"boxdialer"
,
"version"
:
"4.8.
59
"
,
"version"
:
"4.8.
60
"
,
"description"
:
""
,
"main"
:
"src/boxDialer.js"
,
"scripts"
:
{
...
...
src/lib/boxDIaler.js
View file @
9b62f42b
/** @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
'
;
export
class
BoxDialer
{
sTransferNumber
;
oRingTone
;
...
...
@@ -91,10 +92,15 @@ export class BoxDialer {
this
.
options
=
{
eventHandlers
:
this
.
uaEvents
(),
mediaConstraints
:
{
audio
:
true
,
video
:
false
},
mediaConstraints
:
{
audio
:
true
,
video
:
false
},
};
}
setGlobalHistoryData
(
data
){
console
.
log
(
'
setGlobalHistoryData:
'
,
data
)
this
.
globalHistoryData
=
data
}
dialTone
(
freq1
,
freq2
)
{
// merger = context.createChannelMerger(2);
// setTimeout(() => {
...
...
@@ -130,6 +136,7 @@ export class BoxDialer {
// ? this.oscillator2.start(0)
// : this.oscillator2.noteOn(0);
}
start
()
{
// if (typeof this.oscillator1 != 'undefined') this.oscillator1.disconnect();
// if (typeof this.oscillator2 != 'undefined') this.oscillator2.disconnect();
...
...
@@ -149,6 +156,7 @@ export class BoxDialer {
// this.oscillator1 = null;
// this.oscillator2 = null;
}
uaEvents
()
{
return
{
progress
:
(
e
)
=>
{
...
...
@@ -193,7 +201,7 @@ export class BoxDialer {
});
window
.
navigator
.
mediaDevices
.
getUserMedia
({
audio
:
true
})
.
getUserMedia
({
audio
:
true
})
.
then
(
function
(
stream
)
{
console
.
log
(
'
User_Danied_Media_Access
'
,
...
...
@@ -300,7 +308,7 @@ export class BoxDialer {
greeting
.
addEventListener
(
'
click
'
,
cbk
);
}
onSoundType
({
type
,
bool
})
{
onSoundType
({
type
,
bool
})
{
this
.
ringtone
.
remove
();
this
.
waitRingTone
.
remove
();
this
.
pickSound
.
remove
();
...
...
@@ -347,7 +355,7 @@ 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
);
...
...
@@ -479,11 +487,36 @@ export class BoxDialer {
type
:
'
connectingIncoming
'
,
from
:
this
?.
callSession
?.
_remote_identity
?.
_uri
?.
user
,
});
if
(
this
.
callSession
.
direction
===
'
incoming
'
)
{
let
second
console
.
log
(
'
auto_answer is work:
'
,
this
.
globalHistoryData
?.
autoAnswer
)
if
(
this
.
globalHistoryData
?.
autoAnswer
)
{
switch
(
this
.
globalHistoryData
?.
autoAnswerSecond
)
{
case
1
:
second
=
1000
break
case
40
:
second
=
3000
break
case
100
:
second
=
6000
break
default
:
second
=
0
}
console
.
log
(
'
auto_answer second:
'
,
second
)
setTimeout
(()
=>
{
console
.
log
(
'
auto_answer run boxDialer.answerButtonClick()
'
)
this
.
answerButtonClick
()
},
second
)
}
this
.
showNotification
(()
=>
{
this
.
answerButtonClick
();
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
true
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
true
});
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
stateCode
:
'
connectingIncoming
'
,
...
...
@@ -513,7 +546,7 @@ export class BoxDialer {
e
,
);
// the call has answered
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
setGuiPhoneState
({
funcName
:
'
modalState
'
,
funcParam
:
{
...
...
@@ -586,7 +619,7 @@ export class BoxDialer {
type
:
null
,
});
this
.
stopInnerTimer
();
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
closeBxCall
();
this
.
hangupButtonClick
();
this
.
setGuiPhoneState
({
...
...
@@ -732,7 +765,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
)
{
...
...
@@ -742,9 +775,11 @@ export class BoxDialer {
this
.
removeViExternalCard
();
}
}
closeBxCall
()
{
if
(
window
.
BX24
&&
window
.
BX24
.
placement
)
{
window
?.
BX24
.
placement
.
call
(
'
CallCardClose
'
,
{},
()
=>
{});
window
?.
BX24
.
placement
.
call
(
'
CallCardClose
'
,
{},
()
=>
{
});
}
else
if
(
window
.
alovoicePhone
&&
window
.
alovoicePhone
.
callMethods
&&
...
...
@@ -754,7 +789,7 @@ export class BoxDialer {
}
}
setGuiPhoneState
({
stateCode
,
funcName
,
funcParam
})
{
setGuiPhoneState
({
stateCode
,
funcName
,
funcParam
})
{
if
(
window
?.
alovoice_wsphone
&&
!!
stateCode
?.
length
)
{
console
.
log
(
'
this_getBxUiState_stateCode
'
,
...
...
@@ -763,7 +798,7 @@ export class BoxDialer {
);
this
.
callBxMethods
({
bxMethodName
:
'
CallCardSetUiState
'
,
bxFuncParams
:
{
uiState
:
this
.
getBxUiState
(
stateCode
)
},
bxFuncParams
:
{
uiState
:
this
.
getBxUiState
(
stateCode
)
},
callback
:
(
e
)
=>
{
console
.
log
(
e
,
`CallCardSetUiState method done
${
e
}
`
);
},
...
...
@@ -782,11 +817,12 @@ 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,
...
...
@@ -796,7 +832,7 @@ export class BoxDialer {
entities
:
[
{
id
:
'
user
'
,
// пользователи
options
:
{
selectFields
:
[
'
ufPhoneInner
'
]
},
options
:
{
selectFields
:
[
'
ufPhoneInner
'
]
},
},
{
id
:
'
department
'
,
// структура компании: выбор только пользователей
...
...
@@ -804,7 +840,7 @@ export class BoxDialer {
],
events
:
{
'
_Item:onSelect
'
:
(
event
)
=>
{
const
{
item
}
=
event
.
getData
();
const
{
item
}
=
event
.
getData
();
const
dialog
=
event
.
getTarget
();
const
selectedItems
=
dialog
.
getSelectedItems
();
...
...
@@ -832,9 +868,11 @@ export class BoxDialer {
sipHangUp
()
{
console
.
log
(
'
sipHangUp
'
);
}
sipUnRegister
()
{
console
.
log
(
'
sipUnRegister
'
);
}
sipTransfer
()
{
console
.
log
(
'
sipTransfer
'
);
}
...
...
@@ -868,12 +906,12 @@ export class BoxDialer {
}
skipButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
hangupButtonClick
();
}
answerButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
callSession
?.
answer
(
this
.
options
);
this
.
callSession
.
connection
.
addEventListener
(
'
addstream
'
,
(
event
)
=>
{
this
.
remoteAudio
.
srcObject
=
event
.
stream
;
...
...
@@ -888,39 +926,42 @@ export class BoxDialer {
addCommentButtonClick
()
{
console
.
log
(
'
addCommentButtonClick
'
);
}
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
});
}
}
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
});
}
}
closeButtonClick
()
{
this
.
hangupButtonClick
();
}
hangupButtonClick
()
{
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSoundType
({
type
:
'
ring
'
,
bool
:
false
});
this
.
onSipStateChange
.
innerCallerModal
({
bool
:
false
,
type
:
null
,
...
...
@@ -937,12 +978,15 @@ export class BoxDialer {
transferButtonClick
(
number
)
{
this
.
callSession
.
refer
(
number
,
this
.
options
);
}
cancelTransferButtonClick
()
{
console
.
log
(
'
cancelTransferButtonClick
'
);
}
completeTransferButtonClick
()
{
console
.
log
(
'
completeTransferButtonClick
'
);
}
nextButtonClick
()
{
console
.
log
(
'
nextButtonClick
'
);
}
...
...
@@ -950,13 +994,16 @@ export class BoxDialer {
entityChanged
()
{
console
.
log
(
'
entityChanged
'
);
}
qualityMeterClick
()
{
console
.
log
(
'
qualityMeterClick
'
);
}
dialpadButtonClick
(
c
)
{
console
.
log
(
'
dialpadButtonClick
'
);
this
.
sipSendDTMF
(
c
);
}
notifyAdminButtonClick
()
{
console
.
log
(
'
notifyAdminButtonClick
'
);
}
...
...
src/root/index.jsx
View file @
9b62f42b
...
...
@@ -39,9 +39,11 @@ const Root = ({wsphonedata, onSetDnd, setWsphonedata, callMethod}) => {
}
},
[
secondLine
]);
useEffect
(()
=>
{
boxDialer
.
setGlobalHistoryData
(
useColorConfigStore
.
state
)
},
[
useColorConfigStore
.
state
])
useEffect
(()
=>
{
boxDialer
.
globalHistoryData
=
useColorConfigStore
.
state
if
(
wsphonedata
&&
wsphonedata
?.
number
)
{
boxDialer
.
setSipStateChangeCallback
(
setDynamicValue
,
'
dynamicValue
'
);
boxDialer
.
setSipStateChangeCallback
(
setModalState
,
'
modalState
'
);
...
...
@@ -90,33 +92,11 @@ const Root = ({wsphonedata, onSetDnd, setWsphonedata, callMethod}) => {
};
useEffect
(()
=>
{
console
.
log
(
'
auto_answer running:
'
,
modalState
.
callType
===
'
incoming
'
&&
modalState
.
bool
)
if
(
modalState
.
callType
===
'
incoming
'
&&
modalState
.
bool
){
let
second
if
(
useColorConfigStore
.
state
?.
autoAnswer
)
{
switch
(
useColorConfigStore
.
state
?.
autoAnswerSecond
)
{
case
1
:
second
=
1000
break
case
40
:
second
=
3000
break
case
100
:
second
=
6000
break
default
:
second
=
0
}
console
.
log
(
'
auto_answer second:
'
,
second
)
setTimeout
(()
=>
{
console
.
log
(
'
auto_answer run boxDialer.answerButtonClick()
'
)
boxDialer
.
answerButtonClick
()
},
second
)
}
}
},
[
modalState
.
callType
,
modalState
.
bool
,
useColorConfigStore
.
state
?.
autoAnswer
,
useColorConfigStore
.
state
?.
autoAnswerSecond
])
// useEffect(()=> {
// console.log('auto_answer running: ', modalState.callType === 'incoming' && modalState.bool)
//
// }, [modalState.callType, modalState.bool, useColorConfigStore.state?.autoAnswer, useColorConfigStore.state?.autoAnswerSecond])
//
const
selectWidjetType
=
(
type
)
=>
{
switch
(
type
)
{
...
...
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