I've loaded the Android SIP Demo into Android Studio. I registered an account on getonsip.com, added it to my phone accounts, and verified it works by calling the phone from the getonsip.com webapp and also from one Android phone to another. All good so far.
I modified the Java code from the demo slightly to accommodate the getonsip settings:
SipProfile.Builder builder = new SipProfile.Builder(username, domain);
builder.setOutboundProxy(proxy);
builder.setPassword(password);
builder.setAuthUserName(auth);
builder.setAutoRegistration(true);
builder.setPort(5060);
builder.setProtocol("UDP");
sipProfile = builder.build();
I then deployed it to my phone (Galaxy S4, Android 4.4.2 API 19). However, when I try to place a call to myself like this:
sipCall = sipManager.makeAudioCall(sipProfile.getUriString(), sipAddress, listener, 30);
I always get the same error:
05-14 11:43:13.476 5061-5080/android.SipDemo W/System.err﹕ android.net.sip.SipException: Failed to create SipSession; network unavailable?
Other posts on StackOverflow and around the internet have not helped me. I've tried adding a 5 second delay before calling, rebooting the phone, and changing the target SIP address to include sip:<address>@getonsip.com
and also sip:<address>@getonsip.com:5060
, but always the same error message.
Does anybody know how to resolve this?