Skip to content

Auth implementation#1

Merged
Mansi-frejun merged 10 commits intostagingfrom
authImplementation
Dec 4, 2025
Merged

Auth implementation#1
Mansi-frejun merged 10 commits intostagingfrom
authImplementation

Conversation

@preetamfrejun
Copy link
Copy Markdown
Contributor

  • Added Android Manifest permissions for RECORD_AUDIO and INTERNET
  • Implemented runtime permission request in App.js to prevent crashes
  • Added WebRTC registerGlobals() polyfill for sip.js compatibility
  • Fixed UserAgent.makeCall to properly await the SIP invitation
  • Resolved race condition in Softphone initialization hook

Comment thread eslint.config.mjs Outdated
Comment thread example/src/App.tsx Outdated
Comment thread src/core/Auth.ts Outdated
Comment thread src/core/Auth.ts
Comment thread src/core/Softphone.ts Outdated
// this.endCurrentSession();

if(!this.#userAgent){
throw new Exceptions.UnknownException('Softphone.#handleEdgeDomainChange', 'UserAgent is not initialized');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to check if useragent is present when changing edge domain as useragent will be re-registered anyways.

Comment thread src/core/Softphone.ts Outdated
};

if(!this.#userAgent){
this.#userAgent = new UserAgent(config);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to have this if condition as you are explicitly setting useragent to null before it.

Comment thread src/core/Softphone.ts Outdated
throw new Exceptions.UnknownException('Softphone.makeCall', JSON.stringify(responseData.message || ''));
}

console.log('Update primary virtual number successful.');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the console log under 200 block

Comment thread src/services/CallService.ts Outdated
Comment thread src/services/TokenManager.ts Outdated
Comment thread src/utils/validation.ts
import { jwtDecode } from 'jwt-decode';
import libphonenumber from "google-libphonenumber";

export const isTokenValid = (token: string) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better if we return a structured status object here instead of mixing booleans and strings? Something like - { valid: true } or { valid: false, reason: 'EXPIRED' | 'INVALID' })
(better for type check)

Comment thread src/utils/validation.ts Outdated
Comment thread src/core/Softphone.ts Outdated
Comment thread src/core/Auth.ts
#virtualNumbers: VirtualNumber[] = [];
#primaryVirtualNumber: string | null = null;

public constructor(tokenData?: TokenData) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public can be removed as constructor is by default public

@Mansi-frejun Mansi-frejun merged commit 0e152df into staging Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants