Browse Source

correcoes de encoding e numero durante chamada

1.8-dev
Matheo Bonucia 4 months ago
parent
commit
22751e2268
  1. 61
      appWebrtc/keypad.js
  2. 6
      appWebrtc/simplesipsdk.js

61
appWebrtc/keypad.js

@ -34,7 +34,7 @@ const KeypadSimplesIP = (function () {
});
const createKeyPad = () => {
// Função para verificar e definir o tema inicial
// Funcao para verificar e definir o tema inicial
const initialThemeMode = sessionStorage.getItem("themeMode") || "light";
const simplesipStateCall = (initialStateCall) => {
let stateCall = initialStateCall;
@ -71,9 +71,7 @@ const KeypadSimplesIP = (function () {
//RECEBENDO CHAMADA
let otherNumber = "Indefinido";
UASimplesIP.simplesipEvento.on("incomingcall", function (callerNumber) {
if (otherNumber) {
otherNumber = callerNumber;
}
otherNumber = callerNumber;
stateCurrent.setStateCall("incomingcall");
});
//FAZENDO CHAMADA
@ -81,7 +79,8 @@ const KeypadSimplesIP = (function () {
stateCurrent.setStateCall("outgoingcall");
});
//EM CHAMADA
UASimplesIP.simplesipEvento.on("incall", function () {
UASimplesIP.simplesipEvento.on("incall", function (calleNumber) {
otherNumber = calleNumber;
stateCurrent.setStateCall("incall");
});
//NA HOME
@ -96,7 +95,7 @@ const KeypadSimplesIP = (function () {
const simplesipCreateContainer = (themeMode) => {
let simplesipContainer = document.querySelector(".simplesipContainer");
// Verifica se já existe um container, e se existir, remove-o
// Verifica se ja existe um container, e se existir, remove-o
if (simplesipContainer) {
simplesipContainer.remove();
}
@ -116,7 +115,7 @@ const KeypadSimplesIP = (function () {
let titles = document.querySelector(".simplesipTitles");
if (titles) {
// Remover todos os próximos irmãos de titles
// Remover todos os pr�ximos irmaos de titles
let proximoIrmao = titles.nextSibling;
while (proximoIrmao) {
let irmaoRemovido = proximoIrmao;
@ -170,7 +169,7 @@ const KeypadSimplesIP = (function () {
const titleConfig = document.createElement("div");
titleConfig.id = "titleConfig";
titleConfig.textContent = "Configurações do usuário";
titleConfig.textContent = "Configurações de usuário";
const formScreen = document.createElement("form");
formScreen.id = "form";
@ -219,7 +218,7 @@ const KeypadSimplesIP = (function () {
});
divUnregister.appendChild(textoUnregister);
divUnregister.appendChild(unregisterBtn);
// Função para criar elementos <label> com suas respectivas legendas
// Funcao para criar elementos <label> com suas respectivas legendas
const createLabelAndInput = (
labelText,
inputName,
@ -269,7 +268,7 @@ const KeypadSimplesIP = (function () {
"Insira a senha do ramal"
);
// Adicionar botões ao formulário
// Adicionar bot�es ao formulario
const divBtns = document.createElement("div");
divBtns.classList.add("divBtns");
divBtns.appendChild(btnCancel);
@ -289,7 +288,7 @@ const KeypadSimplesIP = (function () {
configScreen.appendChild(formScreen);
container.appendChild(configScreen);
// Função para preencher os inputs com os valores do localStorage
// Funcao para preencher os inputs com os valores do localStorage
const fillInputsFromLocalStorage = () => {
inputServidor.querySelector("input").value =
localStorage.getItem("servidor") || "";
@ -306,9 +305,9 @@ const KeypadSimplesIP = (function () {
// Preencha os inputs com os valores armazenados no localStorage
fillInputsFromLocalStorage();
// Adicione um ouvinte de eventos para o evento submit do formulário
// Adicione um ouvinte de eventos para o evento submit do formulario
formScreen.addEventListener("submit", function (event) {
event.preventDefault(); // Evita que o formulário seja enviado normalmente
event.preventDefault(); // Evita que o formulario seja enviado normalmente
// Coleta os valores dos inputs
const servidor = inputServidor.querySelector("input").value;
@ -324,7 +323,7 @@ const KeypadSimplesIP = (function () {
localStorage.setItem("ramal", ramal);
localStorage.setItem("senha", senha);
// Salva primeiramente os valores nas configurações do agente
// Salva primeiramente os valores nas configura��es do agente
UASimplesIP.config.PROTOCOLO = "wss";
UASimplesIP.config.SERVIDOR = servidor;
UASimplesIP.config.PORTA = porta;
@ -335,7 +334,7 @@ const KeypadSimplesIP = (function () {
if (servidor === "" || ramal === "" || senha === "") {
simplesipCreateAlert(
container,
"Por favor, insira os dados necessários"
"Por favor, insira os dados necess�rios"
);
} else {
stateCurrent.setStateCall("home");
@ -343,13 +342,13 @@ const KeypadSimplesIP = (function () {
}
});
};
// Variável para controlar se uma tela de alerta já está sendo exibida
// Vari�vel para controlar se uma tela de alerta ja est� sendo exibida
let isAlertDisplayed = false;
const simplesipCreateAlert = (container, message) => {
// Verifica se uma tela de alerta já está sendo exibida
// Verifica se uma tela de alerta ja est� sendo exibida
if (isAlertDisplayed) {
return; // Sai da função se uma tela de alerta já estiver sendo exibida
return; // Sai da Funcao se uma tela de alerta ja estiver sendo exibida
}
const createAlert = document.createElement("div");
@ -365,17 +364,17 @@ const KeypadSimplesIP = (function () {
btnAlert.id = "btnAlert";
btnAlert.textContent = "OK";
btnAlert.addEventListener("click", () => {
// Remove a tela de alerta ao clicar no botão "OK"
// Remove a tela de alerta ao clicar no botao "OK"
container.removeChild(createAlert);
// Atualiza a variável para indicar que a tela de alerta foi removida
// Atualiza a vari�vel para indicar que a tela de alerta foi removida
isAlertDisplayed = false;
});
createAlert.appendChild(btnAlert);
// Adiciona a tela de alerta ao contêiner
// Adiciona a tela de alerta ao cont�iner
container.appendChild(createAlert);
// Atualiza a variável para indicar que uma tela de alerta está sendo exibida
// Atualiza a vari�vel para indicar que uma tela de alerta est� sendo exibida
isAlertDisplayed = true;
};
@ -392,7 +391,7 @@ const KeypadSimplesIP = (function () {
const bnTransfer = createButtonTransfer();
const keyPadIncall = createKeypadIncall();
//Configura outro display pra mostrar com quem está falando
//Configura outro display pra mostrar com quem est� falando
const displayOtherNumber = document.createElement("div");
const userIcon = document.createElement("img");
userIcon.src = userImg;
@ -407,7 +406,7 @@ const KeypadSimplesIP = (function () {
otherNumberText.textContent = otherNumber;
displayOtherNumber.appendChild(otherNumberText);
//Cria display que mostra todas as opções da chamada
//Cria display que mostra todas as op��es da chamada
const displayInCall = document.createElement("div");
displayInCall.classList.add("displayInCall");
displayInCall.id = "displayInCall";
@ -560,7 +559,7 @@ const KeypadSimplesIP = (function () {
if (storedNumberCall != "") {
numberOutgoingCall.textContent = "Ligando para " + storedNumberCall;
} else {
numberOutgoingCall.textContent = "Digite um número e tente novamente";
numberOutgoingCall.textContent = "Digite um n�mero e tente novamente";
}
container.appendChild(numberOutgoingCall);
@ -723,7 +722,7 @@ const KeypadSimplesIP = (function () {
header.appendChild(simplesipClearDisplay);
};
// Função para lidar com cliques nos botões
// Funcao para lidar com cliques nos bot�es
const handleClick = (buttonValue) => {
const display = document.getElementById("display");
const maxLength = 11;
@ -787,14 +786,14 @@ const KeypadSimplesIP = (function () {
const defineStatusAgent = (status) => {
const circleElements = document.querySelectorAll(".circle");
// Verifica se circleElements não é undefined e se tem comprimento maior que zero
// Verifica se circleElements nao e undefined e se tem comprimento maior que zero
if (circleElements && circleElements.length > 0) {
// Remove qualquer uma dessas classes antes de atualizar
circleElements.forEach((circle) =>
circle.classList.remove("online", "away", "busy", "unknown", "error")
);
// Atualiza conforme o parâmetro passado
// Atualiza conforme o par�metro passado
switch (status) {
case "registered":
if (circleElements[0]) {
@ -947,7 +946,7 @@ const KeypadSimplesIP = (function () {
simplesipContainer.classList.remove("dark");
}
// Aplicar o tema apenas onde há uma classe light ou dark
// Aplicar o tema apenas onde h� uma classe light ou dark
const elementosComClasse = document.querySelectorAll(
"#simplesipContainer .light, #simplesipContainer .dark"
);
@ -984,7 +983,7 @@ const KeypadSimplesIP = (function () {
nextElement = nextElement.nextElementSibling;
}
const btnMinimize = document.getElementById("btn-minimize");
isKeyPadMinimized = !isKeyPadMinimized; // Inverter a variável aqui
isKeyPadMinimized = !isKeyPadMinimized; // Inverter a vari�vel aqui
if (isKeyPadMinimized) {
btnMinimize.classList.remove("btn-minimize");
btnMinimize.classList.add("btn-expand");
@ -1019,7 +1018,7 @@ const KeypadSimplesIP = (function () {
function startTimer() {
if (!timer) {
// Verifica se o timer já está em execução
// Verifica se o timer ja esta em execu�ao
timer = setInterval(attTimer, 1000);
}
}

6
appWebrtc/simplesipsdk.js

@ -268,7 +268,7 @@ const UASimplesIP = (function () {
incomingCallAudio.pause();
outgoingCallAudio.pause();
eventoSip.emit("incall");
eventoSip.emit("incall", newSession.remote_identity.uri.user);
});
newSession.on("newDTMF", function (event) {
@ -384,7 +384,7 @@ const UASimplesIP = (function () {
_Autenticacao.SENHA === undefined
) {
console.error(
":::: Configuração do Usuário Inválida para Autenticação no PBX !"
":::: Configuração do Usuário Inválida para Autenticação no PBX !"
);
} else {
ativaDebug(false);
@ -420,7 +420,7 @@ const UASimplesIP = (function () {
help: function () {
console.log("========================================================");
console.log("=== Unified Communications - Simples Ip - Versão 1.2 ===");
console.log("=== Unified Communications - Simples Ip - Version 1.2 ===");
console.log("========================================================");
},
};

Loading…
Cancel
Save