velis velis - 2 months ago 36
Android Question

Connect Android SIP to OfficeSip server

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: username@server_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:

  • user@server_domain/server_ip

  • server_domain/server_ip

  • server_domain@server_ip

  • many other combinations

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?

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.


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.