Open tuna1207 opened 5 years ago
@tunguyenbhtech I'm also facing this issue, were you able to make it work with @cmendes0101 's hack?
@platonish i haven't tried out @cmendes0101 's fork but since it's a hack, seems like it still has some problems like @iBuntaah is having with resume side https://github.com/datso/react-native-pjsip/issues/152#issuecomment-449344553
@tunguyenbhtech I was somewhat able to make it work using his fork.
If you're using push notifications to handle your incoming calls, then note that AppState
will report the app to be in the background
when the notification is received, so that will need to be handled separately to make sure your callback isn't fired when a notification is received.
Also, when using Android Oreo or higher, the device won't let you start a service after the app's been in the background for a while. I get this in my logcat:
java.lang.IllegalStateException: Not allowed to start service Intent { act=start cmp=com.myapp/com.carusto.ReactNativePjSip.PjSipService (has extras) }: app is in background uid UidRecord{e8cb856 u0a241 RCVR bg:+3m45s46ms idle change:uncached procs:1 seq(0,0,0)}
I was able to get around this by registering after a short delay once the app comes to the foreground. [link]
For outgoing calls, what I ended up doing was:
stop()
method.createAccount()
method. makeCall()
as usual. Not sure why, but this works for me.
I'm still not confident of this solution, as it is full of hacks, and I wasn't able to test all edge cases, but it seems to work for now.
Anyone solved this? I've been trying to add foreground to this. so far, no success.
not sure if it can be the ultimate solution.
Performing a unregister and register works fine with backgrounding and foregrounding the android app but when the app is backgrounded after a few minutes it seems like GC goes through and destroys the pjsua.
This causes the app to crash when it is brought back into the foreground and endpoint.registerAccount is ran. "A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 30997 (PjSipService), pid 30532 (COM.PACKAGE)"
Is there a good way to work around this? Per some PJSIP bug reports it mentions trying to destroy before GC runs, so I tried to do that with deleting the accounts but still no luck.
This does not happen on iOS, just for android
152
@cmendes0101 forked and made a hack and closed that issue but i opened this one since we don't have a real solution.