Loading services/java/com/android/server/sip/SipHelper.java +9 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading Loading @@ -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 { Loading @@ -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); Loading services/java/com/android/server/sip/SipService.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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()) { Loading services/java/com/android/server/sip/SipSessionGroup.java +30 −13 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); Loading @@ -321,7 +339,7 @@ class SipSessionGroup implements SipListener { Dialog mDialog; ServerTransaction mServerTransaction; ClientTransaction mClientTransaction; byte[] mPeerSessionDescription; String mPeerSessionDescription; boolean mInCall; boolean mReRegisterFlag = false; Loading Loading @@ -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)); Loading @@ -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)); } Loading Loading @@ -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; Loading Loading @@ -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: Loading Loading @@ -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; Loading Loading @@ -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; } Loading @@ -1072,7 +1089,7 @@ class SipSessionGroup implements SipListener { return (SipProfile) getSource(); } public SessionDescription getSessionDescription() { public String getSessionDescription() { return mSessionDescription; } } Loading services/java/com/android/server/sip/SipSessionListenerProxy.java +2 −2 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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() { Loading voip/java/android/net/sip/ISipSession.aidl +3 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -143,5 +142,5 @@ interface ISipSession { * * @param sessionDescription the new session description */ void changeCall(in SessionDescription sessionDescription); void changeCall(String sessionDescription); } Loading
services/java/com/android/server/sip/SipHelper.java +9 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading Loading @@ -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 { Loading @@ -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); Loading
services/java/com/android/server/sip/SipService.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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()) { Loading
services/java/com/android/server/sip/SipSessionGroup.java +30 −13 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); Loading @@ -321,7 +339,7 @@ class SipSessionGroup implements SipListener { Dialog mDialog; ServerTransaction mServerTransaction; ClientTransaction mClientTransaction; byte[] mPeerSessionDescription; String mPeerSessionDescription; boolean mInCall; boolean mReRegisterFlag = false; Loading Loading @@ -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)); Loading @@ -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)); } Loading Loading @@ -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; Loading Loading @@ -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: Loading Loading @@ -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; Loading Loading @@ -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; } Loading @@ -1072,7 +1089,7 @@ class SipSessionGroup implements SipListener { return (SipProfile) getSource(); } public SessionDescription getSessionDescription() { public String getSessionDescription() { return mSessionDescription; } } Loading
services/java/com/android/server/sip/SipSessionListenerProxy.java +2 −2 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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() { Loading
voip/java/android/net/sip/ISipSession.aidl +3 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -143,5 +142,5 @@ interface ISipSession { * * @param sessionDescription the new session description */ void changeCall(in SessionDescription sessionDescription); void changeCall(String sessionDescription); }