Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 614d8b2e authored by André Černâk's avatar André Černâk
Browse files

Make SIP User-Agent timeout configurable via Settings->Call Settings>Internet...

Make SIP User-Agent timeout configurable via Settings->Call Settings>Internet Call Settings>Accounts

Change-Id: Ic568ee8d453b1aa3831d9b85635730f497c42f84
parent 2a9cbc29
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import javax.sip.address.URI;
public class SipProfile implements Parcelable, Serializable, Cloneable {
    private static final long serialVersionUID = 1L;
    private static final int DEFAULT_PORT = 5060;
    private static final int DEFAULT_KEEPALIVE_INTERVAL = 15;
    private static final String TCP = "TCP";
    private static final String UDP = "UDP";
    private Address mAddress;
@@ -53,6 +54,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
    private String mAuthUserName;
    private int mPort = DEFAULT_PORT;
    private boolean mSendKeepAlive = false;
    private int mKeepAliveInterval = DEFAULT_KEEPALIVE_INTERVAL;
    private boolean mAutoRegistration = true;
    private transient int mCallingUid = 0;

@@ -255,6 +257,17 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
            return this;
        }

        /**
         * Sets the send keep-alive interval.
         *
         * @param keep-alive message interval in seconds
         * @return this builder object
         */
        public Builder setKeepAliveInterval(int interval) {
            mProfile.mKeepAliveInterval = interval;
            return this;
        }


        /**
         * Sets the auto. registration flag.
@@ -331,6 +344,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
        mProfileName = in.readString();
        mUserAgent = in.readString();
        mSendKeepAlive = (in.readInt() == 0) ? false : true;
        mKeepAliveInterval = in.readInt();
        mAutoRegistration = (in.readInt() == 0) ? false : true;
        mCallingUid = in.readInt();
        mPort = in.readInt();
@@ -347,6 +361,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
        out.writeString(mProfileName);
        out.writeString(mUserAgent);
        out.writeInt(mSendKeepAlive ? 1 : 0);
        out.writeInt(mKeepAliveInterval);
        out.writeInt(mAutoRegistration ? 1 : 0);
        out.writeInt(mCallingUid);
        out.writeInt(mPort);
@@ -485,6 +500,15 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
        return mSendKeepAlive;
    }

    /**
     * Gets the value of 'Keep-alive interval'.
     *
     * @return the Keep-alive interval in seconds.
     */
    public int getKeepAliveInterval() {
        return mKeepAliveInterval;
    }

    /**
     * Gets the flag of 'Auto Registration'.
     *
+2 −1
Original line number Diff line number Diff line
@@ -697,7 +697,7 @@ public final class SipService extends ISipService.Stub {
    // All methods will be invoked in sync with SipService.this.
    private class KeepAliveProcess implements Runnable {
        private static final String TAG = "\\KEEPALIVE/";
        private static final int INTERVAL = 10;
        private int INTERVAL = 10;
        private SipSessionGroup.SipSessionImpl mSession;
        private boolean mRunning = false;

@@ -707,6 +707,7 @@ public final class SipService extends ISipService.Stub {

        public void start() {
            if (mRunning) return;
            this.INTERVAL = mSession.getLocalProfile().getKeepAliveInterval();
            mRunning = true;
            mTimer.set(INTERVAL * 1000, this);
        }