Commit 70f59cbe authored by Muhammadali's avatar Muhammadali

update-

parent dfe5a541
...@@ -13,6 +13,13 @@ window.BoxDialer = new BoxDialer(); ...@@ -13,6 +13,13 @@ window.BoxDialer = new BoxDialer();
const container = document.getElementById('boxdialerwidjet'); const container = document.getElementById('boxdialerwidjet');
const root = createRoot(container); const root = createRoot(container);
window.onbeforeunload = () => {
if (typeof BX !== 'undefined') {
localStorage.removeItem('mycall');
localStorage.removeItem(BX.bitrix_sessid() + '_mycall');
}
};
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<LanguageController> <LanguageController>
......
...@@ -344,6 +344,7 @@ export class BoxDialer { ...@@ -344,6 +344,7 @@ export class BoxDialer {
stun_server: 'stun:stun.l.google.com:19302', stun_server: 'stun:stun.l.google.com:19302',
register_expires: 60, register_expires: 60,
}); });
if (typeof BX !== 'undefined') {
window.localStorage.setItem( window.localStorage.setItem(
BX.bitrix_sessid() + '_mycall', BX.bitrix_sessid() + '_mycall',
this.ua.configuration.instance_id, this.ua.configuration.instance_id,
...@@ -352,6 +353,8 @@ export class BoxDialer { ...@@ -352,6 +353,8 @@ export class BoxDialer {
'mycall', 'mycall',
this.ua.configuration.instance_id, this.ua.configuration.instance_id,
); );
}
this.ua.on('connected', (e) => { this.ua.on('connected', (e) => {
console.log( console.log(
'%c sip_register [connected]: ', '%c sip_register [connected]: ',
......
...@@ -66,13 +66,22 @@ const Root = ({ wsphonedata, onSetDnd, setWsphonedata, callMethod }) => { ...@@ -66,13 +66,22 @@ const Root = ({ wsphonedata, onSetDnd, setWsphonedata, callMethod }) => {
); );
if ( if (
typeof BX !== 'undefined' &&
window.localStorage.getItem(BX.bitrix_sessid() + '_mycall') && window.localStorage.getItem(BX.bitrix_sessid() + '_mycall') &&
window.localStorage.getItem('mycall') window.localStorage.getItem('mycall')
) { ) {
console.log('UA is running!'); console.log('UA is running! in other tab');
} else { } else {
boxDialer.sipRegister(wsphonedata); boxDialer.sipRegister(wsphonedata);
} }
// setTimeout(function waitBxImPhoneTo() {
// if (BX && BX.IM) {
// initBxImPhoneTo();
// } else {
// setTimeout(waitBxImPhoneTo, 1);
// }
// }, 1);
} }
}, []); }, []);
......
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