Connect Android SIP to OfficeSip server

velis Source

I am developing an Android SIP client. I'd like to test it against OfficeSip server. So I have set up the officeSip server locally and I can connect to it via officeSIP messenger (the client).

The messenger requires this data to login:

  • List item
  • addr: [email protected]_domain
  • username: username
  • password: password
  • protocol: protocol
  • server address: server address

However, when trying to do the same in Android, its SipProfile.Builder has a bit different parameters. Of note are the following:

public SipProfile.Builder (String username, String serverDomain)
public SipProfile.Builder setOutboundProxy (String outboundProxy)

There doesn't seem to be a server address available.

I have tried the following for serverDomain parameter:

However, I'm either getting connection error (when @ is used) or registration failed event (when / is used with server IP after the /). Error codes are -4 (When some error occurs on the device, possibly due to a bug) first, immediately followed by -9 (The client is in a transaction and cannot initiate a new one)

How can I connect to OfficeSIP using Android SIP client?

Edit: I managed to establish communication with CSipSimpleClient which uses a custom SIP stack. It only required server name (equal to server's domain), username and password.

androidsip

Answers

answered 3 years ago ogoooood #1

I'm not sure.. but '@' and '/' are not allowed and SipProfile.Builder will make a URI, e.g. "[email protected](or ip)", with username and serverDomain parameters. Just try to set like this.. ("user1", "test.com"), ("user1", "1.1.1.1").

API description says "the SIP server domain; if the network address is different from the domain, use setOutboundProxy(String) to set server address" about serverDomain.

answered 3 years ago velis #2

Turns out, Android SIP stack is quite immature and finnicky.

Ultimately I was able to connect by specifying both server hostname and server proxy. Also, if server domain differs from computer name server is running on, you WILL have issues connecting. Domain must match either IP address or computer name, but they must match in order to connect via Android SIP client.

answered 5 months ago S4NT14G0 #3

I have successfully connected to OfficeSIP with the android SIP API.

  1. Download the SipDemo here
  2. In WalkieTalkieActivity.java I modified the code to be the following:

    SipProfile.Builder builder = new SipProfile.Builder("test", "officesip.local");

    builder.setPassword("test");

    builder.setOutboundProxy("192.168.10.191");

    builder.setAutoRegistration(true);

    me = builder.build();

  3. In OfficeSIP test is the user with a password also test. The outbound proxy is the IP of the computer or server hosting OfficeSIP and officesip.local is the SIP domain name, which can be found in OfficeSIP under ther settings tab.

  4. To test this I made a second account on OfficeSIP and logged into that account using Sipdroid. From there I called the SipDemo app running on a second phone and it worked.

comments powered by Disqus