这是我的注册码:
SipProfile.Builder builder = new SipProfile.Builder(username, ip);
builder.setPort(Integer.parseInt(port));
builder.setPassword(password);
builder.setSendKeepAlive(true);
builder.setAutoRegistration(true);
sipProfile = builder.build();
Intent i = new Intent();
i.setAction(ACTION);
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i,
Intent.FILL_IN_DATA);
sipManager.open(sipProfile, pi, null);
sipManager.setRegistrationListener(sipProfile.getUriString(),
new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
Log.e("SipService",
"Registering with SIP Server...\n"
+ localProfileUri);
}
public void onRegistrationDone(String localProfileUri,
long expiryTime) {
Log.e("SipService", "Ready: " + localProfileUri);
}
public void onRegistrationFailed(
String localProfileUri, int errorCode,
String errorMessage) {
Log.e("SipService", "Error: " + errorCode + " " + rorMessage);
Handler handler = new Handler(Looper
.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(SipService.this,
R.string.sip_registration_error,
Toast.LENGTH_LONG).show();
}
});
}
});
虽然有时它注册成功,但大多数时候我得到一个错误代码 -9:
10-08 14:49:53.389: E/SipService(5793): Error: -9 0
我在参考网站上找到了这个描述:
public static final int IN_PROGRESS
The client is in a transaction and cannot initiate a new one.
Constant Value: -9 (0xfffffff7)
究竟是什么意思?我的手机上没有运行任何其他 SIP 应用程序。