react-native-pjsip icon indicating copy to clipboard operation
react-native-pjsip copied to clipboard

Account is not creating after deleting any other account.

Open basheerkohli opened this issue 6 years ago • 12 comments

Hey Datso,

My application is like creating an account every time when i want to make a call. What happening is account is creating for the first time and call functionality is fine when i hangup call everything seems perfect, but for the next turn when am calling await endpoint.createaccount(confg) the promise is neiter resolving nor rejecting. I tested same scenario without deleting the account other time but then the accounts are creating then. Please help me out of this it been blocker for me.

Thanks

basheerkohli avatar Nov 15 '18 09:11 basheerkohli

This case happening in the android application development.

basheerkohli avatar Nov 15 '18 09:11 basheerkohli

Having the same issue

rodrigowbazevedo avatar Nov 19 '18 02:11 rodrigowbazevedo

Why do you need to create and delete accounts so often?

Why don't you just create the account or update its credentials if needed and make calls using the one account?

That being said, you shouldn't have issues deleting and creating accounts. Within my app, I do exactly that when a user logs out and back in.

mdiflorio avatar Dec 10 '18 20:12 mdiflorio

Why do you need to create and delete accounts so often?

Why don't you just create the account or update its credentials if needed and make calls using the one account?

That being said, you shouldn't have issues deleting and creating accounts. Within my app, I do exactly that when a user logs out and back in.

I create dynamic accounts so after use it once it becomes invalid and I don't need it anymore, this issue happens if you use de deleteAccount() method, but it won't if you use registerAccount(account, false) method to unregister.

I didn't test yet to delete the account after unregister it.

rodrigowbazevedo avatar Dec 10 '18 21:12 rodrigowbazevedo

I have the same issue.

mobdim avatar Jan 25 '19 12:01 mobdim

Any updates on this? This is a serious issue when using push notifications to receive calls. The problem is that when I use either of the deleteAccount() or registerAccount(account, false) methods, re-registering creates another duplicate registration on top of the old one. This causes both the registrations to respond to call events simultaneously.

That being said, you shouldn't have issues deleting and creating accounts. Within my app, I do exactly that when a user logs out and back in.

@mierz00 how exactly are you deleting the account?

glocore avatar Feb 05 '19 17:02 glocore

@rodrigowbazevedo I wasn't able to get it to work with either of the methods, how do you prevent duplicate account registrations?

glocore avatar Feb 15 '19 14:02 glocore

@rodrigowbazevedo I wasn't able to get it to work with either of the methods, how do you prevent duplicate account registrations?

My application get the account credentials from the backend after login, my backend always return a unique new account, after logout I unregister the account using registerAccount(account, false), it's working for me.

rodrigowbazevedo avatar Feb 15 '19 14:02 rodrigowbazevedo

@rodrigowbazevedo Thanks for your response! What do you do to register after you log back in? Do you use createAccount() to generate a new account? Because that's where I'm facing the issue of duplicate registrations.

glocore avatar Feb 18 '19 09:02 glocore

I've added more details here, if that helps.

glocore avatar Feb 18 '19 11:02 glocore

Same issue, I'm crashing when I try to createAccount after registerAccount(account, false) and deleteAccount(account), I'm trying to do Login and Logout

yunhanxia avatar Apr 23 '19 08:04 yunhanxia

@basheerkohli did you managed to solve the issue. I am facing the same issue as well. After creating 4 accounts, i am getting this error

error register : Title: pjsua_acc_add(&pj_acc_cfg, make_default, &id) Code: 70010 Description: Too many objects of the specified type (PJ_ETOOMANY) Location: ../src/pjsua2/account.cpp:733

This problem mainly occurs, where we allow users to manually enter the configuration details (domain, password, proxy, transport etc) for registration and even if they enter incorrect credentials and submit the request to endpoint.createaccount() is considered and after 4 requests i am getting above error.

To prevent this i have done following :-

  1. If user tries to send same data repeatedly, i am calling endpoint.registerAccount(account, true) on that account so that the 4 request limit is not reached.'

  2. I am keeping check on the accounts created on endpoint and if Number of accounts are more than 1, i am deleting the 1st account in the array returned by endpoint state using endpoint.deleteAccount(account). This works properly in some cases, but most of the time when i try to register another account after delete, the app crashes with following error log

2019-11-08 19:29:04.732 21628-21706/com.ivy_mobile D/PjSipLogWriter: 19:29:04.732            
pjsua_acc.c  .Acc 1: setting registration..
    
    --------- beginning of crash
2019-11-08 19:29:04.735 21628-21706/com.ivy_mobile A/libc: FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x75d91088a8)
2019-11-08 19:29:04.775 21628-21706/com.ivy_mobile A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 21706 (PjSipService), pid 21628 (com.ivy_mobile)

Can someone please help how to handle the delete and create accounts more gracefully without crash so that the limit is not exceeded ? Any suggestions @rodrigowbazevedo @mierz00 @glocore @datso

rohitvc avatar Nov 08 '19 14:11 rohitvc