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

Commit eaa511fd authored by repo sync's avatar repo sync Committed by Android (Google) Code Review
Browse files

Merge "resolved conflicts for merge of 12eaf9d5 to master"

parents 0525f95b 3d67c568
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import gov.nist.javax.sip.SipStackExt;
import gov.nist.javax.sip.clientauthutils.AccountManager;
import gov.nist.javax.sip.clientauthutils.AuthenticationHelper;

import android.net.sip.SessionDescription;
import android.net.sip.SipProfile;
import android.util.Log;

@@ -243,7 +242,7 @@ class SipHelper {
    }

    public ClientTransaction sendInvite(SipProfile caller, SipProfile callee,
            SessionDescription sessionDescription, String tag)
            String sessionDescription, String tag)
            throws SipException {
        try {
            FromHeader fromHeader = createFromHeader(caller, tag);
@@ -259,9 +258,9 @@ class SipHelper {
                    toHeader, viaHeaders, maxForwards);

            request.addHeader(createContactHeader(caller));
            request.setContent(sessionDescription.getContent(),
            request.setContent(sessionDescription,
                    mHeaderFactory.createContentTypeHeader(
                            "application", sessionDescription.getType()));
                            "application", "sdp"));

            ClientTransaction clientTransaction =
                    mSipProvider.getNewClientTransaction(request);
@@ -273,12 +272,12 @@ class SipHelper {
    }

    public ClientTransaction sendReinvite(Dialog dialog,
            SessionDescription sessionDescription) throws SipException {
            String sessionDescription) throws SipException {
        try {
            Request request = dialog.createRequest(Request.INVITE);
            request.setContent(sessionDescription.getContent(),
            request.setContent(sessionDescription,
                    mHeaderFactory.createContentTypeHeader(
                            "application", sessionDescription.getType()));
                            "application", "sdp"));

            ClientTransaction clientTransaction =
                    mSipProvider.getNewClientTransaction(request);
@@ -326,7 +325,7 @@ class SipHelper {
     * @param event the INVITE request event
     */
    public ServerTransaction sendInviteOk(RequestEvent event,
            SipProfile localProfile, SessionDescription sessionDescription,
            SipProfile localProfile, String sessionDescription,
            ServerTransaction inviteTransaction)
            throws SipException {
        try {
@@ -334,9 +333,9 @@ class SipHelper {
            Response response = mMessageFactory.createResponse(Response.OK,
                    request);
            response.addHeader(createContactHeader(localProfile));
            response.setContent(sessionDescription.getContent(),
            response.setContent(sessionDescription,
                    mHeaderFactory.createContentTypeHeader(
                            "application", sessionDescription.getType()));
                            "application", "sdp"));

            if (inviteTransaction == null) {
                inviteTransaction = getServerTransaction(event);
+4 −1
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ import java.util.TimerTask;
import java.util.TreeSet;
import javax.sip.SipException;

/**
 * @hide
 */
public final class SipService extends ISipService.Stub {
    private static final String TAG = "SipService";
    private static final int EXPIRY_TIME = 3600;
@@ -442,7 +445,7 @@ public final class SipService extends ISipService.Stub {

        @Override
        public void onRinging(ISipSession session, SipProfile caller,
                byte[] sessionDescription) {
                String sessionDescription) {
            synchronized (SipService.this) {
                try {
                    if (!isRegistered()) {
+30 −13
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import gov.nist.javax.sip.clientauthutils.AccountManager;
import gov.nist.javax.sip.clientauthutils.UserCredentials;
import gov.nist.javax.sip.header.SIPHeaderNames;
import gov.nist.javax.sip.header.WWWAuthenticate;
import gov.nist.javax.sip.message.SIPMessage;

import android.net.sip.ISipSession;
import android.net.sip.ISipSessionListener;
@@ -31,6 +32,7 @@ import android.text.TextUtils;
import android.util.Log;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.DatagramSocket;
import java.text.ParseException;
import java.util.Collection;
@@ -284,6 +286,22 @@ class SipSessionGroup implements SipListener {
        }
    }

    private String extractContent(Message message) {
        // Currently we do not support secure MIME bodies.
        byte[] bytes = message.getRawContent();
        if (bytes != null) {
            try {
                if (message instanceof SIPMessage) {
                    return ((SIPMessage) message).getMessageContent();
                } else {
                    return new String(bytes, "UTF-8");
                }
            } catch (UnsupportedEncodingException e) {
            }
        }
        return null;
    }

    private class SipSessionCallReceiverImpl extends SipSessionImpl {
        public SipSessionCallReceiverImpl(ISipSessionListener listener) {
            super(listener);
@@ -302,7 +320,7 @@ class SipSessionGroup implements SipListener {
                newSession.mPeerProfile = createPeerProfile(event.getRequest());
                newSession.mState = SipSessionState.INCOMING_CALL;
                newSession.mPeerSessionDescription =
                        event.getRequest().getRawContent();
                        extractContent(event.getRequest());
                addSipSession(newSession);
                mProxy.onRinging(newSession, newSession.mPeerProfile,
                        newSession.mPeerSessionDescription);
@@ -321,7 +339,7 @@ class SipSessionGroup implements SipListener {
        Dialog mDialog;
        ServerTransaction mServerTransaction;
        ClientTransaction mClientTransaction;
        byte[] mPeerSessionDescription;
        String mPeerSessionDescription;
        boolean mInCall;
        boolean mReRegisterFlag = false;

@@ -401,12 +419,12 @@ class SipSessionGroup implements SipListener {
        }

        public void makeCall(SipProfile peerProfile,
                SessionDescription sessionDescription) {
                String sessionDescription) {
            doCommandAsync(
                    new MakeCallCommand(peerProfile, sessionDescription));
        }

        public void answerCall(SessionDescription sessionDescription) {
        public void answerCall(String sessionDescription) {
            try {
                processCommand(
                        new MakeCallCommand(mPeerProfile, sessionDescription));
@@ -419,7 +437,7 @@ class SipSessionGroup implements SipListener {
            doCommandAsync(END_CALL);
        }

        public void changeCall(SessionDescription sessionDescription) {
        public void changeCall(String sessionDescription) {
            doCommandAsync(
                    new MakeCallCommand(mPeerProfile, sessionDescription));
        }
@@ -726,10 +744,9 @@ class SipSessionGroup implements SipListener {
            if (evt instanceof MakeCallCommand) {
                MakeCallCommand cmd = (MakeCallCommand) evt;
                mPeerProfile = cmd.getPeerProfile();
                SessionDescription sessionDescription =
                        cmd.getSessionDescription();
                mClientTransaction = mSipHelper.sendInvite(mLocalProfile,
                        mPeerProfile, sessionDescription, generateTag());
                        mPeerProfile, cmd.getSessionDescription(),
                        generateTag());
                mDialog = mClientTransaction.getDialog();
                addSipSession(this);
                mState = SipSessionState.OUTGOING_CALL;
@@ -811,7 +828,7 @@ class SipSessionGroup implements SipListener {
                    return true;
                case Response.OK:
                    mSipHelper.sendInviteAck(event, mDialog);
                    mPeerSessionDescription = response.getRawContent();
                    mPeerSessionDescription = extractContent(response);
                    establishCall();
                    return true;
                case Response.PROXY_AUTHENTICATION_REQUIRED:
@@ -897,7 +914,7 @@ class SipSessionGroup implements SipListener {
                // got Re-INVITE
                RequestEvent event = mInviteReceived = (RequestEvent) evt;
                mState = SipSessionState.INCOMING_CALL;
                mPeerSessionDescription = event.getRequest().getRawContent();
                mPeerSessionDescription = extractContent(event.getRequest());
                mServerTransaction = null;
                mProxy.onRinging(this, mPeerProfile, mPeerSessionDescription);
                return true;
@@ -1060,10 +1077,10 @@ class SipSessionGroup implements SipListener {
    }

    private class MakeCallCommand extends EventObject {
        private SessionDescription mSessionDescription;
        private String mSessionDescription;

        public MakeCallCommand(SipProfile peerProfile,
                SessionDescription sessionDescription) {
                String sessionDescription) {
            super(peerProfile);
            mSessionDescription = sessionDescription;
        }
@@ -1072,7 +1089,7 @@ class SipSessionGroup implements SipListener {
            return (SipProfile) getSource();
        }

        public SessionDescription getSessionDescription() {
        public String getSessionDescription() {
            return mSessionDescription;
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ class SipSessionListenerProxy extends ISipSessionListener.Stub {
    }

    public void onRinging(final ISipSession session, final SipProfile caller,
            final byte[] sessionDescription) {
            final String sessionDescription) {
        if (mListener == null) return;
        proxy(new Runnable() {
            public void run() {
@@ -83,7 +83,7 @@ class SipSessionListenerProxy extends ISipSessionListener.Stub {
    }

    public void onCallEstablished(final ISipSession session,
            final byte[] sessionDescription) {
            final String sessionDescription) {
        if (mListener == null) return;
        proxy(new Runnable() {
            public void run() {
+3 −4
Original line number Diff line number Diff line
@@ -115,8 +115,7 @@ interface ISipSession {
     * @param sessionDescription the session description of this call
     * @see ISipSessionListener
     */
    void makeCall(in SipProfile callee,
            in SessionDescription sessionDescription);
    void makeCall(in SipProfile callee, String sessionDescription);

    /**
     * Answers an incoming call with the specified session description. The
@@ -125,7 +124,7 @@ interface ISipSession {
     *
     * @param sessionDescription the session description to answer this call
     */
    void answerCall(in SessionDescription sessionDescription);
    void answerCall(String sessionDescription);

    /**
     * Ends an established call, terminates an outgoing call or rejects an
@@ -143,5 +142,5 @@ interface ISipSession {
     *
     * @param sessionDescription the new session description
     */
    void changeCall(in SessionDescription sessionDescription);
    void changeCall(String sessionDescription);
}
Loading