Я попытался написать приложение Simple SIP на Android. Я использую API 19 android и использую звездочку как сервер SIP. Однако я обнаружил, что каждый раз, когда я выполняю SipManager.open(), он регистрируется дважды. Когда я звоню, вызывают два канала.SIP регистрируется дважды на android
Мой код, как показано ниже:
Intent intent = new Intent();
intent.setAction(ACTION_INCOMING_CALL);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, Intent.FILL_IN_DATA);
if (mSipManager == null) {
mSipManager = SipManager.newInstance(this);
}
SipProfile.Builder builder = new SipProfile.Builder("<some sip id>", SIP_SERVER);
builder.setPassword("<sip password>");
mSipProfile = builder.build();
mSipManager.close(mSipProfile.getUriString());
mSipManager.open(mSipProfile, pendingIntent, null);
mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
updateStatus("Registering");
Log.d("SipActivity", "Registering with SIP Server...");
}
public void onRegistrationDone(String localProfileUri, long expiryTime) {
updateStatus("Ready");
Log.d("SipActivity", "Ready");
}
public void onRegistrationFailed(String localProfileUri, int errorCode,
String errorMessage) {
updateStatus("Registration failed." + errorCode + " >>>" + errorMessage);
Log.d("SipActivity", "Registration failed. Please check settings." + errorMessage);
}
});
Я положил журнал, чтобы убедиться, что я называю открытым один раз, но журналы показали «Регистрация с сервером SIP» дважды и «Ready» дважды.