SIP: remove dependency on javax.sip
and change errorCodeString to errorCode in SipRegistrationListener.onRegistrationFailed(). Change-Id: Id9618f5a4b0effaed04f8b0dc60347499d9e4501
This commit is contained in:
@@ -1161,7 +1161,7 @@ class SipSessionGroup implements SipListener {
|
|||||||
.setPort(uri.getPort())
|
.setPort(uri.getPort())
|
||||||
.setDisplayName(address.getDisplayName())
|
.setDisplayName(address.getDisplayName())
|
||||||
.build();
|
.build();
|
||||||
} catch (InvalidArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new SipException("createPeerProfile()", e);
|
throw new SipException("createPeerProfile()", e);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new SipException("createPeerProfile()", e);
|
throw new SipException("createPeerProfile()", e);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package android.net.sip;
|
package android.net.sip;
|
||||||
|
|
||||||
import android.net.sip.ISipSessionListener;
|
import android.net.sip.ISipSessionListener;
|
||||||
import android.net.sip.SessionDescription;
|
|
||||||
import android.net.sip.SipProfile;
|
import android.net.sip.SipProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -502,13 +502,14 @@ public class SipManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onRegistrationFailed(ISipSession session, String errorCode,
|
public void onRegistrationFailed(ISipSession session, String errorCode,
|
||||||
String message) {
|
String message) {
|
||||||
mListener.onRegistrationFailed(getUri(session), errorCode, message);
|
mListener.onRegistrationFailed(getUri(session),
|
||||||
|
Enum.valueOf(SipErrorCode.class, errorCode), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRegistrationTimeout(ISipSession session) {
|
public void onRegistrationTimeout(ISipSession session) {
|
||||||
mListener.onRegistrationFailed(getUri(session),
|
mListener.onRegistrationFailed(getUri(session),
|
||||||
SipErrorCode.TIME_OUT.toString(), "registration timed out");
|
SipErrorCode.TIME_OUT, "registration timed out");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,11 +167,15 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
|
|||||||
*
|
*
|
||||||
* @param port port number of the server
|
* @param port port number of the server
|
||||||
* @return this builder object
|
* @return this builder object
|
||||||
* @throws InvalidArgumentException if the port number is out of range
|
* @throws IllegalArgumentException if the port number is out of range
|
||||||
*/
|
*/
|
||||||
public Builder setPort(int port) throws InvalidArgumentException {
|
public Builder setPort(int port) throws IllegalArgumentException {
|
||||||
mUri.setPort(port);
|
try {
|
||||||
return this;
|
mUri.setPort(port);
|
||||||
|
return this;
|
||||||
|
} catch (InvalidArgumentException e) {
|
||||||
|
throw new IllegalArgumentException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,16 +184,16 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
|
|||||||
*
|
*
|
||||||
* @param protocol the protocol string
|
* @param protocol the protocol string
|
||||||
* @return this builder object
|
* @return this builder object
|
||||||
* @throws InvalidArgumentException if the protocol is not recognized
|
* @throws IllegalArgumentException if the protocol is not recognized
|
||||||
*/
|
*/
|
||||||
public Builder setProtocol(String protocol)
|
public Builder setProtocol(String protocol)
|
||||||
throws InvalidArgumentException {
|
throws IllegalArgumentException {
|
||||||
if (protocol == null) {
|
if (protocol == null) {
|
||||||
throw new NullPointerException("protocol cannot be null");
|
throw new NullPointerException("protocol cannot be null");
|
||||||
}
|
}
|
||||||
protocol = protocol.toUpperCase();
|
protocol = protocol.toUpperCase();
|
||||||
if (!protocol.equals("UDP") && !protocol.equals("TCP")) {
|
if (!protocol.equals("UDP") && !protocol.equals("TCP")) {
|
||||||
throw new InvalidArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"unsupported protocol: " + protocol);
|
"unsupported protocol: " + protocol);
|
||||||
}
|
}
|
||||||
mProfile.mProtocol = protocol;
|
mProfile.mProtocol = protocol;
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ public interface SipRegistrationListener {
|
|||||||
* Called when the registration fails.
|
* Called when the registration fails.
|
||||||
*
|
*
|
||||||
* @param localProfileUri the URI string of the SIP profile to register with
|
* @param localProfileUri the URI string of the SIP profile to register with
|
||||||
* @param errorCode error code defined in {@link SipErrorCode}
|
* @param errorCode error code of this error
|
||||||
* @param errorMessage error message
|
* @param errorMessage error message
|
||||||
*/
|
*/
|
||||||
void onRegistrationFailed(String localProfileUri, String errorCode,
|
void onRegistrationFailed(String localProfileUri, SipErrorCode errorCode,
|
||||||
String errorMessage);
|
String errorMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user