TP-89230 | softcode sip credentials

This commit is contained in:
varnit goyal
2024-11-03 18:49:17 +05:30
parent db1aae78df
commit 2cc80593ea
2 changed files with 16 additions and 15 deletions

View File

@@ -216,7 +216,7 @@ function saveCallOptions() {
}
}
export function loadCredentials({displayName, privateIdentity, publicIdentity, password, realm, phoneNumber}) {
export function loadCredentials({accountName, userName, domain, password}) {
if (false) {
// IE retuns 'null' if not defined
let s_value;
@@ -231,12 +231,12 @@ export function loadCredentials({displayName, privateIdentity, publicIdentity, p
if ((s_value = window.localStorage.getItem('org.doubango.identity.realm')))
txtRealm.value = s_value;
} else {
window.txtDisplayName.value = 'webrtc_testuser2';
window.txtPrivateIdentity.value = 'webrtc_testuser2';
window.txtPublicIdentity.value = 'sip:webrtc_testuser2@naviindore.ameyo.net:9089';
window.txtDisplayName.value = accountName;
window.txtPrivateIdentity.value = userName;
window.txtPublicIdentity.value = `sip:${userName}@${domain}`;
window.txtPassword.value = 'e4e215dd';
window.txtRealm.value = 'naviindore.ameyo.net';
window.txtPassword.value = password;
window.txtRealm.value = domain?.split(':')?.[0] //for example : naviindore.ameyo.net;
window.txtPhoneNumber.value = '701020';
}
}

View File

@@ -62,16 +62,11 @@ class AmeyoAdapter implements IAdapter {
}
_initializeSipStack = () => {
_initializeSipStack = ({accountName, userName, domain, password}) => {
console.log('initializing sip stack');
//initialize sip stack
loadCredentials({
displayName: this.sipAccountInfo.displayName,
password: this.sipAccountInfo.password,
phoneNumber: this.sipAccountInfo.phoneNumber,
privateIdentity: this.sipAccountInfo.private,
publicIdentity: this.sipAccountInfo.publicIdentity,
realm: this.sipAccountInfo.realm});
loadCredentials({accountName, userName, domain, password});
loadCallOptions();
sipRegister();
@@ -95,7 +90,13 @@ class AmeyoAdapter implements IAdapter {
}
if(payload?.data?.requestKey === RequestKeys.SIP_ACCOUNT_INFO) {
console.log('sip account info', payload?.data?.response);
this._initializeSipStack();
const response = payload?.data?.response;
this._initializeSipStack({
accountName: response?.accountName,
userName: response?.userName,
domain: response?.domain,
password: response?.secret
});
this.sipAccountInfo = payload?.data?.response;
setAutoStatus(this.sessionId);
attachOmniqueService(this.sessionId, this.userName.toLowerCase());