Here is my registration code:
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();
}
});
}
});
Though sometimes it registered successfully, most time I got a error code -9:
10-08 14:49:53.389: E/SipService(5793): Error: -9 0
I found this description on reference site:
public static final int IN_PROGRESS
The client is in a transaction and cannot initiate a new one.
Constant Value: -9 (0xfffffff7)
What does it means exactly? I don't have any other SIP application running on my phone.