I want to connect via UPD to my sip server, I have the username, the ip address of the server (domain) and the port (for example 9990).
I get the following error:
android.net.sip.SipException: SipService.createSession() returns null
At this line: mSipManager.register(mSipProfile, 300, mSipRegistrationListener);
Here's the code I'm using, adapted from android documentation:
private void startSip() {
LogUtils.LOGE(TAG, "[startSip]");
if (SipManager.isVoipSupported(this) && SipManager.isApiSupported(this)) {
if (mSipManager == null) {
mSipManager = SipManager.newInstance(this);
}
try {
SipProfile.Builder builder = new SipProfile.Builder("sip:user@domainIP:9990");
builder.setPassword("pass");
builder.setProtocol("UDP");
mSipProfile = builder.build();
mSipManager.open(mSipProfile);
mSipManager.register(mSipProfile, 300, mSipRegistrationListener);
mSipManager.setRegistrationListener(mSipProfile.getUriString(), mSipRegistrationListener);
} catch (ParseException e) {
e.printStackTrace();
} catch (SipException e) {
e.printStackTrace();
}
} else {
Log.d(TAG, "SIP is not supported!");
}
}
If I try setting the profile like this:
mSipProfile.Builder builder = new SipProfile.Builder("user", "domain:port");
I get the same error.
If I try:
mSipProfile.Builder builder = new SipProfile.Builder("user", "domain");
builder.setPort(9990);
The same error as above.
If I don't specify the port I will get the following:
registration not running with error code= -4 , followed by: registration timed out with error code= -5
Any ideas how to register to my server using UPD and a custom port? Btw I am testing on WiFi and I have set the permissions and the required "uses-feature" in the manifest.