hi all, im working on andorid sip app using pjsua2 and I have big problem with managing stack when connection is lost. What I read from documetation simplest and way is deinitalize stack, and initalize it again and here is what im trying to do. Here is what I'm doing when I try deinitalize it: public int DeInitializeSipStack() { if (mIsStackRunning && !isDeinitializeStarted) { isDeinitializeStarted = true; Log.d(TAG, "DeInitializeSipStack"); if (toneGenerator != null) { Log.d(TAG, "DeInitializeSipStack toneGenerator"); try { toneGenerator.stopTransmit(mEndpoint.audDevManager().getPlaybackDevMedia()); } catch (Exception e) { Log.e(TAG, "", e); } toneGenerator.delete(); } Log.w(TAG, "Account"); if (mAccount != null) { mAccount.delete(); mAccount = null; } if (mCurrentCall != null && mCurrentCall.isActive()) { Log.w(TAG, "mCurrentall not null"); try { Log.d(this, "mCurrentall not null hangup"); mCurrentall.hangup(new CallOpParam(true)); } catch (Exception e) { Log.e(TAG, "", e); } if (mCurrentCall != null) { Log.d(this, "mCurrentCall try delete"); mCurrentCall.delete(); } mCurrentCall = null; } if (mEndpoint.libIsThreadRegistered()) { Log.w(TAG, "libIsThreadRegistered"); mEndpoint.libStopWorkerThreads(); } try { AudioMediaVector audioMediaVector = mEndpoint.mediaEnumPorts(); for (int i = 0; i < audioMediaVector.size(); i++) { Log.d(this, "audioMedia deleted"); AudioMedia audioMedia = audioMediaVector.get(i); mEndpoint.mediaRemove(audioMedia); audioMedia.delete(); } } catch (Exception e) { Log.e(TAG, "", e); } Log.d(TAG, " Runtime.getRuntime().gc();"); Runtime.getRuntime().gc(); try { Log.d(TAG, "mEndpoint.libDestroy"); mEndpoint.libDestroy(); } catch (Exception e) { isDeinitializeStarted = false; Log.e(TAG, "", e); return -1; } mEndpoint.delete(); mIsStackRunning = false; mEndpoint = null; mInstance = null; isDeinitializeStarted = false; Log.d(TAG, "mEndpoint.delete"); } return 0; } and when internet connection is lost library is stopped on pjsua_acc.c Deleting account 0.. lib is traying to send unregister account and wait for connection, when I dont put account.delete I will receive error on mEndpoint.libDestroy(); there is another issue when internet connection is lost during a call. and also another issue when there is call but in early state and connection is lost. Please help what should I do in all scenarios. BR Andrzej Grajnert -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20150305/dc102612/attachment.html>