Commit 70f59cbe authored by Muhammadali's avatar Muhammadali

update-

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