0

I'm using the code explained here (https://developer.android.com/guide/topics/connectivity/sip.html) and my test SIP server is OfficeSIP

The connection is ok, but whe i try to make disconnection with this lines code

public void closeLocalProfile() {
    if (mSipManager == null) {
       return;
    }
    try {
       if (mSipProfile != null) {
          mSipManager.close(mSipProfile.getUriString());
       }
     } catch (Exception ee) {
       Log.d("WalkieTalkieActivity/onDestroy", "Failed to close local profile.", ee);
     }
}

The server seems that doesn't disconnect the account (even if it is no longer reachable).

enter image description here

what am I doing wrong?

Mimmo
  • 113
  • 1
  • 16

1 Answers1

0

Just call the unregister API before to close:

mSipManager.unregister(mSipProfile,mylistener);
Adam Wright
  • 129
  • 4
  • nothing.. I've written 'manager.close(me.getUriString()); manager.unregister(me, registrationListener);' but it remains connected. Maybe it depend on auto-registration [link](https://developer.android.com/reference/android/net/sip/SipManager.html#open(android.net.sip.SipProfile, android.app.PendingIntent, android.net.sip.SipRegistrationListener)) ? How can i disable it? – Mimmo May 19 '17 at 08:34
  • I think that you should make a network trace to see the actual packets because maybe the problem is on your server or your server doesn't understand the unregister message. When you call unregister, a REGISTER message should be sent with Expire set to 0. – Adam Wright Jun 01 '17 at 06:01