Commit 360f0efa authored by Muhammadali's avatar Muhammadali

update add code for sipRegister isIce

parent 35ebde2a
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "0.8.0", "version": "0.8.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "boxdialer", "name": "boxdialer",
"version": "0.8.0", "version": "0.8.1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.1",
......
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "0.8.1", "version": "0.8.2",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
/** @format */ /** @format */
import React from 'react'; import React from 'react';
import DefaultWidjetStyle, {DialPadIcon} from './style'; import DefaultWidjetStyle, { DialPadIcon } from './style';
import TimerUi from '../TimerUi'; import TimerUi from '../TimerUi';
const DefaultWidjet = ({ const DefaultWidjet = ({
widjetState, widjetState,
phoneNumber, phoneNumber,
reason, reason,
widjetVersion, widjetVersion,
leftTime, leftTime,
onClick onClick,
}) => { }) => {
return ( return (
<DefaultWidjetStyle status={widjetState} onClick={onClick}> <DefaultWidjetStyle status={widjetState} onClick={onClick}>
<div className='left'> <div className='left'>
<p className='title'>{phoneNumber}</p> <p className='title'>{phoneNumber}</p>
<p> <p>
<span className='status'>{widjetState}</span> <span className='status'>{widjetState}</span>
<TimerUi reason={reason} time={leftTime}/> <TimerUi reason={reason} time={leftTime} />
</p> </p>
</div> </div>
<div className='right'> <div className='right'>
<DialPadIcon/> <DialPadIcon />
</div> </div>
<div className='bottom'> <div className='bottom'>
<DefaultWidjetStyle.StatusLine status={widjetState}> <DefaultWidjetStyle.StatusLine status={widjetState}>
<p className='verison'>v {widjetVersion}</p> <p className='verison'>v {widjetVersion}</p>
</DefaultWidjetStyle.StatusLine> </DefaultWidjetStyle.StatusLine>
</div> </div>
</DefaultWidjetStyle> </DefaultWidjetStyle>
); );
}; };
export default DefaultWidjet; export default DefaultWidjet;
...@@ -11,6 +11,7 @@ import PauseIcon from '@mui/icons-material/Pause'; ...@@ -11,6 +11,7 @@ import PauseIcon from '@mui/icons-material/Pause';
import SendToMobileIcon from '@mui/icons-material/SendToMobile'; import SendToMobileIcon from '@mui/icons-material/SendToMobile';
import DialpadIcon from '@mui/icons-material/Dialpad'; import DialpadIcon from '@mui/icons-material/Dialpad';
import CallCardDropDown from '../CallCardDropDown'; import CallCardDropDown from '../CallCardDropDown';
const Modal = ({ const Modal = ({
children, children,
hidden, hidden,
......
...@@ -153,7 +153,7 @@ export class BoxDialer { ...@@ -153,7 +153,7 @@ export class BoxDialer {
} }
} }
sipRegister = ({ number, secret, wsurl }) => { sipRegister = ({ number, secret, wsurl, isIce }) => {
try { try {
Notification.requestPermission(); Notification.requestPermission();
...@@ -174,7 +174,7 @@ export class BoxDialer { ...@@ -174,7 +174,7 @@ export class BoxDialer {
display_name: number, //'3003', display_name: number, //'3003',
websocket_proxy_url: `wss://${wsurl}/ws`, //'wss://cld.alovoice.uz:61040/ws', websocket_proxy_url: `wss://${wsurl}/ws`, //'wss://cld.alovoice.uz:61040/ws',
// outbound_proxy_url: '', //(window.localStorage ? window.localStorage.getItem('org.doubango.expert.sip_outboundproxy_url') : null), // outbound_proxy_url: '', //(window.localStorage ? window.localStorage.getItem('org.doubango.expert.sip_outboundproxy_url') : null),
ice_servers: [{ url: 'stun:stun.l.google.com:19302' }], //(window.localStorage ? window.localStorage.getItem('org.doubango.expert.ice_servers') : null), ice_servers: isIce ? [{ url: 'stun:stun.l.google.com:19302' }] : [], //(window.localStorage ? window.localStorage.getItem('org.doubango.expert.ice_servers') : null),
enable_rtcweb_breaker: true, //(window.localStorage ? window.localStorage.getItem('org.doubango.expert.enable_rtcweb_breaker') == "true" : false), enable_rtcweb_breaker: true, //(window.localStorage ? window.localStorage.getItem('org.doubango.expert.enable_rtcweb_breaker') == "true" : false),
events_listener: { events_listener: {
events: '*', events: '*',
......
/** @format */ /** @format */
import WidjetButton from '../components/WidjetButton'; import WidjetButton from '../components/WidjetButton';
import React, {useCallback, useEffect, useState} from 'react'; import React, { useEffect, useState } from 'react';
import packageJson from '../../package.json'; import packageJson from '../../package.json';
import CallIcon from '@mui/icons-material/Call';
import {toast} from 'react-hot-toast';
// import DropDownTailwind from '../components/TailwindComponents/DropDown';
// import Modal from '../components/Modal';
// import numbers from '../components/WidjetButton/numbers';
// import TimerUi from '../components/TimerUi';
import DefaultWidjet from '../components/DefaultWidjetUi'; import DefaultWidjet from '../components/DefaultWidjetUi';
import ModalPhoneNumpad from "../components/ModalPhoneNumpad" import ModalPhoneNumpad from '../components/ModalPhoneNumpad';
import Modal from "../components/Modal" import Modal from '../components/Modal';
const Root = ({data, onSetDnd, position}) => { const Root = ({ data, onSetDnd, position }) => {
if (!data) {
data = {
iscloud: true,
number: '4003',
wsurl: 'cld.alovoice.uz:61040',
server_id: 40,
secret: '26a830',
reason: 'free',
lefttime: 231461,
reasons: ['free', 'outcalls', 'home', 'totop'],
variant: 'bxmini',
};
}
if (!data) { if (window?.alovoice_wsphone) {
data = { data = window.alovoice_wsphone;
iscloud: true, onSetDnd = window.alovoice_onsetdnd;
number: '4003', }
wsurl: 'cld.alovoice.uz:61040',
server_id: 40,
secret: '26a830',
reason: 'free',
lefttime: 231461,
reasons: ['free', 'outcalls', 'home', 'totop'],
variant: 'bxmini',
};
}
if (window?.alovoice_wsphone) { const [phoneModal, setPhoneModal] = useState(false);
data = window.alovoice_wsphone; const [dynamicValue, setDynamicValue] = useState('pending');
onSetDnd = window.alovoice_onsetdnd; const [modalState, setModalState] = useState(false);
}
const [phoneModal, setPhoneModal] = useState(false); const boxDialer = window.BoxDialer;
const [dynamicValue, setDynamicValue] = useState('pending');
const [modalState, setModalState] = useState(false);
const boxDialer = window.BoxDialer; useEffect(() => {
if (data && data?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.sipRegister(data);
}
}, []);
useEffect(() => { const hangupButton = () => {
if (data && data?.number) { boxDialer.hangupButtonClick();
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue'); };
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.sipRegister(data);
}
}, []);
if (!data || !data?.number) return;
const hangupButton = () => { return (
boxDialer.hangupButtonClick(); <>
}; <DefaultWidjet
widjetState={dynamicValue}
console.log(phoneModal, 'phoneModal') phoneNumber={data?.number}
reason={data?.reason}
if (!data || !data?.number) return; widjetVersion={packageJson?.version}
return ( leftTime={data.lefttime}
<> onClick={() => {
<DefaultWidjet phoneModal ? setPhoneModal(false) : setPhoneModal(true);
widjetState={dynamicValue} }}
phoneNumber={data?.number} />
reason={data?.reason} <ModalPhoneNumpad
widjetVersion={packageJson?.version} modalState={modalState}
leftTime={data.lefttime} phoneModal={phoneModal}
onClick={() => { reasons={data?.reasons}
phoneModal ? setPhoneModal(false) : setPhoneModal(true); reason={data?.reason}
}} onClick={(e) => e.stopPropagation()}
/> dynamicValue={dynamicValue}
<ModalPhoneNumpad onSetDnd={onSetDnd}
modalState={modalState} />
phoneModal={phoneModal} <Modal
reasons={data?.reasons} className='tailwindGlobalCss'
reason={data?.reason} callAnswerType={modalState.callType}
onClick={(e) => e.stopPropagation()} hidden={modalState.bool}
dynamicValue={dynamicValue} callType={modalState.callType}
onSetDnd={onSetDnd} hangupButton={hangupButton}
/> phoneNumber={
<Modal modalState.callType === 'outcoming'
className='tailwindGlobalCss' ? 'inputValue'
callAnswerType={modalState.callType} : modalState.callFromName
hidden={ }
modalState.bool />
// true </>
} );
callType={
modalState.callType
// 'outcoming'
}
hangupButton={hangupButton}
phoneNumber={
modalState.callType === 'outcoming'
? 'inputValue'
: modalState.callFromName
}
/>
</>
);
}; };
export default Root; export default Root;
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