I am using Sip.js library to create a calling app. There seems to be times when the application registers itself multiple times, I have used ua.stop() method which serves the purpose of stopping the useragent but is there a way in which I can identify if all the registrations are made from same application or not so that I can handle them.
user_agent.stop().then(()=>console.log("ua stopped"))
You need to use the extension defined in rfc5626.
In this specification, you need to check the +sip.instance the reg-id parameters.
When the same application registers, you need to re-use the exact same +sip.instance the reg-id parameter. This is how the server can detect if the registration replaces an old one (matching parameters) or is a new one (not matching parameters).
Of course, the server must support/understand those parameters.