Commit 360f0efa authored by Muhammadali's avatar Muhammadali

update add code for sipRegister isIce

parent 35ebde2a
{
"name": "boxdialer",
"version": "0.8.0",
"version": "0.8.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "boxdialer",
"version": "0.8.0",
"version": "0.8.1",
"license": "ISC",
"dependencies": {
"@emotion/react": "^11.11.1",
......
{
"name": "boxdialer",
"version": "0.8.1",
"version": "0.8.2",
"description": "",
"main": "src/boxDialer.js",
"scripts": {
......
/** @format */
import React from 'react';
import DefaultWidjetStyle, {DialPadIcon} from './style';
import DefaultWidjetStyle, { DialPadIcon } from './style';
import TimerUi from '../TimerUi';
const DefaultWidjet = ({
widjetState,
phoneNumber,
reason,
widjetVersion,
leftTime,
onClick
}) => {
return (
<DefaultWidjetStyle status={widjetState} onClick={onClick}>
<div className='left'>
<p className='title'>{phoneNumber}</p>
<p>
<span className='status'>{widjetState}</span>
<TimerUi reason={reason} time={leftTime}/>
</p>
</div>
<div className='right'>
<DialPadIcon/>
</div>
<div className='bottom'>
<DefaultWidjetStyle.StatusLine status={widjetState}>
<p className='verison'>v {widjetVersion}</p>
</DefaultWidjetStyle.StatusLine>
</div>
</DefaultWidjetStyle>
);
widjetState,
phoneNumber,
reason,
widjetVersion,
leftTime,
onClick,
}) => {
return (
<DefaultWidjetStyle status={widjetState} onClick={onClick}>
<div className='left'>
<p className='title'>{phoneNumber}</p>
<p>
<span className='status'>{widjetState}</span>
<TimerUi reason={reason} time={leftTime} />
</p>
</div>
<div className='right'>
<DialPadIcon />
</div>
<div className='bottom'>
<DefaultWidjetStyle.StatusLine status={widjetState}>
<p className='verison'>v {widjetVersion}</p>
</DefaultWidjetStyle.StatusLine>
</div>
</DefaultWidjetStyle>
);
};
export default DefaultWidjet;
......@@ -11,6 +11,7 @@ import PauseIcon from '@mui/icons-material/Pause';
import SendToMobileIcon from '@mui/icons-material/SendToMobile';
import DialpadIcon from '@mui/icons-material/Dialpad';
import CallCardDropDown from '../CallCardDropDown';
const Modal = ({
children,
hidden,
......
......@@ -153,7 +153,7 @@ export class BoxDialer {
}
}
sipRegister = ({ number, secret, wsurl }) => {
sipRegister = ({ number, secret, wsurl, isIce }) => {
try {
Notification.requestPermission();
......@@ -174,7 +174,7 @@ export class BoxDialer {
display_name: number, //'3003',
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),
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),
events_listener: {
events: '*',
......
/** @format */
import WidjetButton from '../components/WidjetButton';
import React, {useCallback, useEffect, useState} from 'react';
import React, { useEffect, useState } from 'react';
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 ModalPhoneNumpad from "../components/ModalPhoneNumpad"
import Modal from "../components/Modal"
import ModalPhoneNumpad from '../components/ModalPhoneNumpad';
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) {
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 (window?.alovoice_wsphone) {
data = window.alovoice_wsphone;
onSetDnd = window.alovoice_onsetdnd;
}
if (window?.alovoice_wsphone) {
data = window.alovoice_wsphone;
onSetDnd = window.alovoice_onsetdnd;
}
const [phoneModal, setPhoneModal] = useState(false);
const [dynamicValue, setDynamicValue] = useState('pending');
const [modalState, setModalState] = useState(false);
const [phoneModal, setPhoneModal] = useState(false);
const [dynamicValue, setDynamicValue] = useState('pending');
const [modalState, setModalState] = useState(false);
const boxDialer = window.BoxDialer;
const boxDialer = window.BoxDialer;
useEffect(() => {
if (data && data?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.sipRegister(data);
}
}, []);
useEffect(() => {
if (data && data?.number) {
boxDialer.setSipStateChangeCallback(setDynamicValue, 'dynamicValue');
boxDialer.setSipStateChangeCallback(setModalState, 'modalState');
boxDialer.sipRegister(data);
}
}, []);
const hangupButton = () => {
boxDialer.hangupButtonClick();
};
if (!data || !data?.number) return;
const hangupButton = () => {
boxDialer.hangupButtonClick();
};
console.log(phoneModal, 'phoneModal')
if (!data || !data?.number) return;
return (
<>
<DefaultWidjet
widjetState={dynamicValue}
phoneNumber={data?.number}
reason={data?.reason}
widjetVersion={packageJson?.version}
leftTime={data.lefttime}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
/>
<ModalPhoneNumpad
modalState={modalState}
phoneModal={phoneModal}
reasons={data?.reasons}
reason={data?.reason}
onClick={(e) => e.stopPropagation()}
dynamicValue={dynamicValue}
onSetDnd={onSetDnd}
/>
<Modal
className='tailwindGlobalCss'
callAnswerType={modalState.callType}
hidden={
modalState.bool
// true
}
callType={
modalState.callType
// 'outcoming'
}
hangupButton={hangupButton}
phoneNumber={
modalState.callType === 'outcoming'
? 'inputValue'
: modalState.callFromName
}
/>
</>
);
return (
<>
<DefaultWidjet
widjetState={dynamicValue}
phoneNumber={data?.number}
reason={data?.reason}
widjetVersion={packageJson?.version}
leftTime={data.lefttime}
onClick={() => {
phoneModal ? setPhoneModal(false) : setPhoneModal(true);
}}
/>
<ModalPhoneNumpad
modalState={modalState}
phoneModal={phoneModal}
reasons={data?.reasons}
reason={data?.reason}
onClick={(e) => e.stopPropagation()}
dynamicValue={dynamicValue}
onSetDnd={onSetDnd}
/>
<Modal
className='tailwindGlobalCss'
callAnswerType={modalState.callType}
hidden={modalState.bool}
callType={modalState.callType}
hangupButton={hangupButton}
phoneNumber={
modalState.callType === 'outcoming'
? 'inputValue'
: modalState.callFromName
}
/>
</>
);
};
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