I'm trying to implement my own android sip implementation and I am having problems registering with my SIP server. Specifically, the SipManager.register() function is throwing a NullPointerException. Has anybody experienced this before? There isn't anything that is null in the below function so I don't understand where this is coming from. Thanks
public boolean initializeProfile() {
final Globals global = Globals.getInstance();
if (sipProfile != null)
closeLocalProfile();
String username = "omitted";
String password = "omitted";
String server = "omitted";
try {
global.Log("Trying to build the profile");
SipProfile.Builder builder = new SipProfile.Builder(username,
server);
builder.setPassword(password);
sipProfile = builder.build();
builder.setAutoRegistration(true);
sipManager.open(sipProfile);
SipRegistrationListener listener = new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
global.Log("Sip Listener- Attempting to Register");
}
public void onRegistrationDone(String localProfileUri,
long expiryTime) {
global.Log("Sip Listener- Registration Success!");
}
public void onRegistrationFailed(String localProfileUri,
int errorCode, String errorMessage) {
global.Log("Sip Listener- Registration Failed");
}
};
sipManager.setRegistrationListener(sipProfile.getUriString(), listener);
//THIS IS WHERE THE EXCEPTION IS BEING THROWN
sipManager.register(sipProfile, 3000, listener);
if (sipManager.isRegistered(sipProfile.getUriString()))
{
global.Log("SipManager is ready for calls");
return true;
}
else
return false;
} catch (Exception ex) {
global.Log("---Error-- initializeProfile: " + ex.getMessage());
return false;
}
}