问题
I have an Elastix server, which is being used by my desktop calling app and Zoiper App perfectly for calling purposes. However my own app, which is using Android SIP is not working fine and I am unable to locate the real problem. Whenever I call for profile registration, it gets failed and error message of REGISTRATION NOT RUNNING shows in the logs.
here is my code snippet:
public void InitializeProfile()
{
if (mSipManager == null)
{
return;
}
if (mSipProfile != null){
closeLocalProfile();
}
SipProfile.Builder builder = null;
try {
builder = new SipProfile.Builder(Username, Domain);
} catch (ParseException e) {
e.printStackTrace();
}
builder.setPassword(Password);
mSipProfile = builder.build();
Intent intent = new Intent();
intent.setAction("android.SipDemo.INCOMING_CALL");
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, Intent.FILL_IN_DATA);
try {
mSipManager.open(mSipProfile, pendingIntent, null);
} catch (SipException e) {
Log.i("open", e.toString());
e.printStackTrace();
}
try {
mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
// updateStatus("Registering with SIP Server...");
Log.i("helloworld", "Registering with SIP Server...");
}
public void onRegistrationDone(String localProfileUri, long expiryTime) {
// updateStatus("Ready");
Log.i("helloworld", "Ready");
}
public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) {
// updateStatus("Registration failed. Please check settings.");
Log.i("helloworld", "Registration failed. Please check settings."+ errorMessage+ " " + Integer.toString(errorCode));
}
});
} catch (SipException e) {
e.printStackTrace();
}
}
来源:https://stackoverflow.com/questions/37682947/stuck-with-android-sip-for-voip-registration-not-running