Commit 21783b00 authored by Muhammadali's avatar Muhammadali

version1.2.5

parent b23b26b7
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "1.2.4", "version": "1.2.5",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
...@@ -36,23 +36,22 @@ const ModalPhoneNumpad = ({ ...@@ -36,23 +36,22 @@ const ModalPhoneNumpad = ({
// }, [call_history]); // }, [call_history]);
const addNumberStorage = ({ number }) => { const addNumberStorage = ({ number }) => {
let stringNumber = number.toString() || ''; // let stringNumber = number.toString() || '';
let storageNumbers = // let storageNumbers =
// (localStorage.getItem('call_history') && // // (localStorage.getItem('call_history') &&
// JSON.parse(localStorage.getItem('call_history'))) || // // JSON.parse(localStorage.getItem('call_history'))) ||
// []; // // [];
console.log( // // console.log(
stringNumber, // // stringNumber,
null === localStorage.getItem('call_history'), // // null === localStorage.getItem('call_history'),
typeof [], // // typeof [],
); // // );
// localStorage.setItem('call_history', [
// localStorage.setItem('call_history', [ // stringNumber,
// stringNumber, // ,
// , // ]);
// ]); // setCall_history([number, ...call_history]);
// setCall_history([number, ...call_history]); // }
// }
}; };
useEffect(() => { useEffect(() => {
if (!modalState.bool) setInputValue(''); if (!modalState.bool) setInputValue('');
......
...@@ -28,6 +28,7 @@ export class BoxDialer { ...@@ -28,6 +28,7 @@ export class BoxDialer {
ringtone; ringtone;
ringbacktone; ringbacktone;
sipState; sipState;
sipBxState;
soundBool; soundBool;
onSipStateChange = {}; onSipStateChange = {};
callEvetsBoxDialer; callEvetsBoxDialer;
...@@ -211,6 +212,18 @@ export class BoxDialer { ...@@ -211,6 +212,18 @@ export class BoxDialer {
this.oSipSessionRegister.register(); this.oSipSessionRegister.register();
} }
getBxUiState(sipState) {
if (sipState && !!sipState.length) sipState = this.sipState;
let uiStates = {
stack_i_new_call: 'connectingIncoming',
call_connected: 'connectingOutgoing',
call_m_stream_audio_remote_added: 'connected',
call_i_ao_request: 'connectingOutgoing',
};
return sipState && uiStates[sipState] ? uiStates[sipState] : 'idle';
}
callBxMethods({ bxMethodName, bxFuncParams, callback }) { callBxMethods({ bxMethodName, bxFuncParams, callback }) {
if (window.BX24 && window.BX24.placement) { if (window.BX24 && window.BX24.placement) {
window?.BX24.placement.call(bxMethodName, bxFuncParams, callback); window?.BX24.placement.call(bxMethodName, bxFuncParams, callback);
...@@ -221,34 +234,13 @@ export class BoxDialer { ...@@ -221,34 +234,13 @@ export class BoxDialer {
setGuiPhoneState({ stateCode, funcName, funcParam }) { setGuiPhoneState({ stateCode, funcName, funcParam }) {
if (window?.alovoice_wsphone) { if (window?.alovoice_wsphone) {
let uiState = false; this.callBxMethods({
bxMethodName: 'CallCardSetUiState',
switch (stateCode) { bxFuncParams: { uiState: this.getBxUiState(stateCode) },
case 'i_new_call': callback: (e) => {
uiState = 'incoming'; console.log(e, `CallCardSetUiState method done ${e}`);
break; },
case 'call_connected': });
uiState = 'connectingOutgoing';
break;
case 'call_m_stream_audio_remote_added':
uiState = 'connected';
break;
case 'call_i_ao_request':
uiState = 'connectingOutgoing';
break;
default:
break;
}
if (uiState) {
this.callBxMethods({
bxMethodName: 'CallCardSetUiState',
bxFuncParams: { uiState },
callback: (e) => {
console.log(e, `CallCardSetUiState method done ${e}`);
},
});
}
} else if (funcName && this.onSipStateChange[funcName] !== 'undefined') { } else if (funcName && this.onSipStateChange[funcName] !== 'undefined') {
this.onSipStateChange[funcName](funcParam); this.onSipStateChange[funcName](funcParam);
} }
...@@ -261,6 +253,8 @@ export class BoxDialer { ...@@ -261,6 +253,8 @@ export class BoxDialer {
this.sipState = type + '_' + event?.type; this.sipState = type + '_' + event?.type;
console.log('---onSessionEvent EVENT [' + this.sipState + ']', event); console.log('---onSessionEvent EVENT [' + this.sipState + ']', event);
this.setGuiPhoneState({ stateCode: this.sipState });
switch (this.sipState) { switch (this.sipState) {
case 'register_stopping': case 'register_stopping':
case 'register_stoped': case 'register_stoped':
...@@ -299,11 +293,11 @@ export class BoxDialer { ...@@ -299,11 +293,11 @@ export class BoxDialer {
break; break;
case 'call_m_stream_audio_remote_added': case 'call_m_stream_audio_remote_added':
case 'call_connected': case 'call_connected':
this.setGuiPhoneState({ stateCode: this.sipState }); // this.setGuiPhoneState({ stateCode: this.sipState });
// QORA EKRANDA ULANYAPTI.. SOZINI VAHTGA OZGARTIRISH KERE ( SEKKUNDAMER ) // QORA EKRANDA ULANYAPTI.. SOZINI VAHTGA OZGARTIRISH KERE ( SEKKUNDAMER )
break; break;
case 'call_i_ao_request': case 'call_i_ao_request':
this.setGuiPhoneState({ stateCode: this.sipState }); // this.setGuiPhoneState({ stateCode: this.sipState });
break; break;
case 'hangup_terminating': case 'hangup_terminating':
...@@ -340,7 +334,7 @@ export class BoxDialer { ...@@ -340,7 +334,7 @@ export class BoxDialer {
this.oSipSessionCall.setConfiguration(this.oConfigCall); this.oSipSessionCall.setConfiguration(this.oConfigCall);
this.onSoundType({ type: 'ring', bool: true }); this.onSoundType({ type: 'ring', bool: true });
this.setGuiPhoneState({ this.setGuiPhoneState({
stateCode: 'i_new_call', // stateCode: 'i_new_call',
funcName: 'modalState', funcName: 'modalState',
funcParam: { funcParam: {
bool: true, bool: true,
......
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