Closed rcorrie closed 6 years ago
Hey, yes thats right. Use the state that library returns, and do not create redundant accounts.
max number of accounts for an endpoint is four...remove the accounts..
@datso any example on how to detect redundant account and delete it?
@basheerkohli Yes I'm aware of the issue, I'm not sure how to remove the accounts, any ideas on the best practice for persisting the account so that I may delete it on app reload?
In order to use endpoint.deleteAccount
you need a reference to the account (which is lost on app reload). Or is there a way to arbitrarily delete all accounts?
Hey, once application starts you should retrieve the existing accounts list that returned form endpoint.start promise, and compare it with account you want (e.g. remove account if it is an outdated one or create a new account)
@datso that's the part I was missing, thank you!
@rcorrie are you able to delete accounts using deleteAccount(account)
? I'm facing this issue when I logout and log back in to my app. It ends up creating duplicate registrations when I log in a second time. As a result, both registrations react to call events.
I tried both deleteAccount(account)
as well as registerAccount(account, false)
, but neither of them worked for me.
Here's how I'm doing it, please let me know if I'm missing something:
const account = await endpoint.createAccount(configuration)
endpoint.registerAccount(account, false);
endpoint.deleteAccount(account);
const account = await endpoint.createAccount(configuration)
<-- doing this creates a duplicate registration despite having deleted the old account at logoutThe registration_changed
event is fired twice. Notice how both have the same id
of 0, which probably means that the old account is indeed getting deleted. Also, I did a packet capture, and the REGISTER request happens only once. But for some reason the registration event inside the library is triggered twice, and subsequently two incoming_call
events, etc.
I think this might be because every time you reload the app via the dev menu, it will register a new account. The app crashes once the max number of accounts has been reached.