Commit f557fe27 authored by Muhammadali's avatar Muhammadali

update-

parent b917dfa9
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "4.1.0", "version": "4.1.1",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
...@@ -36,6 +36,10 @@ const CallHistoryInputDropdown = ({ ...@@ -36,6 +36,10 @@ const CallHistoryInputDropdown = ({
} }
}, [numberSelectHistory]); }, [numberSelectHistory]);
useEffect(() => { }, [
])
return ( return (
<Block> <Block>
<Input <Input
...@@ -43,6 +47,7 @@ const CallHistoryInputDropdown = ({ ...@@ -43,6 +47,7 @@ const CallHistoryInputDropdown = ({
setDefaultHistoryNumberHistory(); setDefaultHistoryNumberHistory();
setModal(!modal); setModal(!modal);
}} }}
id='numbersDiv'
className='nocopy' className='nocopy'
type='text' type='text'
value={inputValue}> value={inputValue}>
......
...@@ -8,24 +8,44 @@ const Block = styled.div` ...@@ -8,24 +8,44 @@ const Block = styled.div`
`; `;
const Input = styled.div` const Input = styled.div`
overflow-x: scroll;
overflow-y: hidden;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
margin: 0; margin: 0;
padding: 0;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 165px;
height: 100%; height: 100%;
max-height: 45px; max-height: 45px;
border-radius: 3px; border-radius: 3px;
background-color: #fff; background-color: #fff;
border: 0; border: 0;
padding: 0 35px 0 10px; padding: 0 0 0 10px;
font-size: 22px; font-size: 22px;
color: #000; color: #000;
display: flex; display: flex;
align-items: center; align-items: center;
::-webkit-scrollbar {
height: 5px;
}
/* Track */
::-webkit-scrollbar-track {
background: #fff0;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #abaaaa;
border-radius: 10px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
}
:focus { :focus {
border-color: inherit; border-color: inherit;
-webkit-box-shadow: none; -webkit-box-shadow: none;
......
...@@ -41,7 +41,7 @@ const ModalPhoneNumpad = ({ ...@@ -41,7 +41,7 @@ const ModalPhoneNumpad = ({
}, [modalState.bool]); }, [modalState.bool]);
const inputController = ({ value, type, from }) => { const inputController = ({ value, type, from }) => {
boxDialer.onSoundType({ type: 'pick', bool: true }); // boxDialer.onSoundType({ type: 'pick', bool: true });
switch (type) { switch (type) {
case 'add': case 'add':
if ( if (
...@@ -224,7 +224,7 @@ const ModalPhoneNumpad = ({ ...@@ -224,7 +224,7 @@ const ModalPhoneNumpad = ({
numberSelectHistory={numberSelectHistory} numberSelectHistory={numberSelectHistory}
setDefaultHistoryNumberHistory={setDefaultHistoryNumberHistory} setDefaultHistoryNumberHistory={setDefaultHistoryNumberHistory}
/> />
{inputValue.length ? ( {inputValue?.length ? (
<Input.BackSpaceIcon <Input.BackSpaceIcon
onClick={() => inputController({ type: 'delete', from: 'button' })} onClick={() => inputController({ type: 'delete', from: 'button' })}
/> />
...@@ -235,6 +235,11 @@ const ModalPhoneNumpad = ({ ...@@ -235,6 +235,11 @@ const ModalPhoneNumpad = ({
<ModalPhoneNumpadStyle.ButtonArea> <ModalPhoneNumpadStyle.ButtonArea>
{numbers?.map((mapItem) => ( {numbers?.map((mapItem) => (
<NumberButton <NumberButton
onMouseDown={() =>
boxDialer.dialTone(mapItem.ringHz[0], mapItem.ringHz[1])
}
onMouseUp={() => boxDialer.stop()}
onMouseOut={() => boxDialer.stop()}
className='nocopy' className='nocopy'
key={mapItem.id} key={mapItem.id}
onClick={() => { onClick={() => {
......
...@@ -34,7 +34,18 @@ export class BoxDialer { ...@@ -34,7 +34,18 @@ export class BoxDialer {
soundBool; soundBool;
onSipStateChange = {}; onSipStateChange = {};
callEvetsBoxDialer; callEvetsBoxDialer;
extnum contextClass =
window.AudioContext ||
window.webkitAudioContext ||
window.mozAudioContext ||
window.oAudioContext ||
window.msAudioContext;
musicContext;
gainNode;
gainNode;
oscillator1;
oscillator2;
extnum;
timer = { timer = {
time: 0, time: 0,
type: null, type: null,
...@@ -81,8 +92,60 @@ export class BoxDialer { ...@@ -81,8 +92,60 @@ export class BoxDialer {
eventHandlers: this.uaEvents(), eventHandlers: this.uaEvents(),
mediaConstraints: { audio: true, video: false }, mediaConstraints: { audio: true, video: false },
}; };
if (this.contextClass) {
// Web Audio API is available.
this.musicContext = new this.contextClass();
}
}
dialTone(freq1, freq2) {
// merger = context.createChannelMerger(2);
this.oscillator1 = this.musicContext.createOscillator();
this.oscillator1.type = 0;
this.oscillator1.frequency.value = freq1;
this.gainNode = this.musicContext.createGain
? this.musicContext.createGain()
: this.musicContext.createGainNode();
this.oscillator1.connect(this.gainNode, 0, 0);
this.gainNode.connect(this.musicContext.destination);
this.gainNode.gain.value = 0.1;
this.oscillator1.start
? this.oscillator1.start(0)
: this.oscillator1.noteOn(0);
// this.gainNode.connect(merger,0,1);
this.oscillator2 = this.musicContext.createOscillator();
this.oscillator2.type = 0;
this.oscillator2.frequency.value = freq2;
this.gainNode = this.musicContext.createGain
? this.musicContext.createGain()
: this.musicContext.createGainNode();
this.oscillator2.connect(this.gainNode);
this.gainNode.connect(this.musicContext.destination);
// this.gainNode.connect(merger,0,0);
this.gainNode.gain.value = 0.1;
this.oscillator2.start
? this.oscillator2.start(0)
: this.oscillator2.noteOn(0);
// merger.connect(context.destination);
}
start() {
if (typeof this.oscillator1 != 'undefined') this.oscillator1.disconnect();
if (typeof this.oscillator2 != 'undefined') this.oscillator2.disconnect();
oscOn(
parseFloat(document.getElementById('freq').value),
parseFloat(document.getElementById('freq2').value),
);
} }
stop() {
this.oscillator1?.disconnect();
this.oscillator2?.disconnect();
}
uaEvents() { uaEvents() {
return { return {
progress: (e) => { progress: (e) => {
...@@ -213,6 +276,9 @@ export class BoxDialer { ...@@ -213,6 +276,9 @@ export class BoxDialer {
} }
onSoundType({ type, bool }) { onSoundType({ type, bool }) {
this.ringtone.remove();
this.waitRingTone.remove();
this.pickSound.remove();
if (this.played) { if (this.played) {
switch (type) { switch (type) {
case 'ring': case 'ring':
...@@ -323,13 +389,6 @@ export class BoxDialer { ...@@ -323,13 +389,6 @@ export class BoxDialer {
e, e,
); );
}); });
this.ua.on('newRTCSession', (e) => {
console.log(
'%c newRTCSession: ',
'font-size: 22px; color: yellow;',
e,
);
});
this.ua.on('newMessage', (e) => { this.ua.on('newMessage', (e) => {
console.log('%c newMessage: ', 'font-size: 22px; color: yellow;', e); console.log('%c newMessage: ', 'font-size: 22px; color: yellow;', e);
}); });
...@@ -350,6 +409,15 @@ export class BoxDialer { ...@@ -350,6 +409,15 @@ export class BoxDialer {
callType: 'connected', callType: 'connected',
}, },
}); });
data.session.connection.onaddstream = (e) => {
console.log('--== UA Conn Added STREAM: ', e);
let strmTrack = e.stream.getAudioTracks();
if (strmTrack[0]) {
let rmMediaStream = new MediaStream([strmTrack[0]]);
this.remoteAudio.srcObject = rmMediaStream;
this.remoteAudio.play();
}
};
// innerCallerModal; // innerCallerModal;
this.onSipStateChange.innerCallerModal({ this.onSipStateChange.innerCallerModal({
bool: true, bool: true,
......
...@@ -8,6 +8,7 @@ const numbers = [ ...@@ -8,6 +8,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [852.0, 1209.0],
}, },
{ {
id: 9, id: 9,
...@@ -16,6 +17,7 @@ const numbers = [ ...@@ -16,6 +17,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [852.0, 1336.0],
}, },
{ {
id: 14, id: 14,
...@@ -24,6 +26,7 @@ const numbers = [ ...@@ -24,6 +26,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [852.0, 1477.0],
}, },
{ {
id: 5, id: 5,
...@@ -32,6 +35,7 @@ const numbers = [ ...@@ -32,6 +35,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [770.0, 1209.0],
}, },
{ {
id: 6, id: 6,
...@@ -40,6 +44,7 @@ const numbers = [ ...@@ -40,6 +44,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [770.0, 1336.0],
}, },
{ {
id: 7, id: 7,
...@@ -48,6 +53,7 @@ const numbers = [ ...@@ -48,6 +53,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [770.0, 1477.0],
}, },
{ {
id: 2, id: 2,
...@@ -56,6 +62,7 @@ const numbers = [ ...@@ -56,6 +62,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [697.0, 1209.0],
}, },
{ {
id: 3, id: 3,
...@@ -64,6 +71,7 @@ const numbers = [ ...@@ -64,6 +71,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [697.0, 1336.0],
}, },
{ {
id: 4, id: 4,
...@@ -72,6 +80,7 @@ const numbers = [ ...@@ -72,6 +80,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [697.0, 1477.0],
}, },
{ {
id: 10, id: 10,
...@@ -80,6 +89,7 @@ const numbers = [ ...@@ -80,6 +89,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [941.0, 1209.0],
}, },
{ {
id: 1, id: 1,
...@@ -88,6 +98,7 @@ const numbers = [ ...@@ -88,6 +98,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [941.0, 1336.0],
}, },
{ {
id: 11, id: 11,
...@@ -96,6 +107,7 @@ const numbers = [ ...@@ -96,6 +107,7 @@ const numbers = [
type: 'number', type: 'number',
style: {}, style: {},
icon: null, icon: null,
ringHz: [941.0, 1477.0],
}, },
// { // {
// id: 12, // id: 12,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment