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?
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.
I'm not sure.. but '#' and '/' are not allowed and SipProfile.Builder will make a URI, e.g. "username#serverDomain(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.
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.
I have successfully connected to OfficeSIP with the android SIP API.
Download the SipDemo here
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();
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.
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.
Related
I have a server and an android app. My server want to request a destination but with the IP of the android device that my app is running on. So I need to proxy the requests (relay them) in my app so the destination could see the client's IP but the server. You can see my explanation in the picture:
How can I do this in my app?
Yes this could be done but not just with relays; you also need to port forwarding mechanism in between. Here is how I would try to do this:
Local portforward the requests of the server onto a dedicated port on your android device and then from their call the Destination server via your relay mechanism which could be fulfilled very succicntly by LittleProxy like solution.
I have to develop a mobile app with audio and video functionality. I browsed the web, I found out I need a SIP server. An SIP server does it works like Apache for web apps?
I also found this :
public SipProfile mSipProfile = null;
...
SipProfile.Builder builder = new SipProfile.Builder(username, domain);
builder.setPassword(password);
mSipProfile = builder.build();
But then at which point in my project I should tell that username = xxxx and domain = yyyy? Actually I cannot see the flow clearly it is starting from where and ending where..
Do you guys have a tutorial that I can follow?
A SIP server is the main component of an IP PBX, and mainly deals with the setup of all SIP calls in the network. A SIP server is also referred to as a SIP Proxy or a Registrar. Although the SIP server is the most important part of the SIP based phone system, it only handles call setup and call tear down. It does not actually transmit or receive any audio. This is done by the media server in RTP.
There are some widely used free & open source SIP servers like Asterisk, FreeSWITCH & penSIPS etc.
You can check here for list of SIP servers
You need to create SIP account or user on SIP server. Client will register to that SIP server using that SIP account with username & password.
Domain is basically SIP server's DNS hostname or IP address.
After registration to SIP server, client can make & receive audio or video calls.
Checkout here for SIP Demo app in android
I am making an app that uses socket programming. Client side is programmed using android and server side using Java. The IP address of the server may change and the IP address has to be kept secure and private.
I do not want the users to install the app again and again when the IP of server changes.
You can use domain for your server . your domain is static and not change dynamically.
for example your domain is : yoursystem.com
now your server ip is : xxx.xxx.xxx.xxx
and tomarow your ip change to yyy.yyy.yyy.yyy
but your domain address is static and user can conect to your domain.
if your privacy is important you can improve your privacy by set token for your user and ...
I am working on an app where ,i am able to send an image only one way,from client to groupowner.How can i send it in both ways?
I had done bi-directional data transfer in my project. In Wifi Direct group owner Ip is decided by OS itself which is known to both devices i.e Server as well as client. Client know the IP of server on which it has to send data, But server don't know the client IP.
For that you have to send client IP address to server and store that address in sharedPrefrences. So you should initiate transfer silently when connection made so that server store the client IP, for next transfer.
Socket client = serverSocket.accept();
String WiFiClientIp = client.getInetAddress().getHostAddress();
you can made a check while transfer i.e if IP don't match server Ip then send data to client IP.
For testing purpose when you send file from client to server, in AsyncTask doinbackground method you can get the IP address of client which is also decide by OS itself. Put that IP statically then you will be able to send file on client also.
I will share my code on github soon. I hope this info will help you.
Working Bi-Directional Data Transfer APK File-> https://play.google.com/store/apps/details?id=anuj.wifidirect&hl=en
I am using port 5060 set on internal profile while the external has 5080.I have created extensions on the server.
I want user to connect sip server using the external profile defined in external.xml i.e
ext_no#XX.YY.ZZ.PP:5080.It says
2013-12-06 05:48:28.740200 [WARNING] sofia_reg.c:2454 Can't find user [ext_no#XX.YY.ZZ.PP] You must define a domain called 'XX.YY.ZZ.PP' in your directory and
add a user with the id="ext_no" attribute and you must configure your
device to use the proper domain in it's authentication credentials.
While it can successfully connect using internal sip profile by just changing the port no,i.e with sip URI:
ext_no#XX.YY.ZZ.PP:5060 and says:
[WARNING] sofia_reg.c:1432 SIP auth challenge (REGISTER) on sofia
profile 'internal' for [ext_no#XX.YY.ZZ.PP] from ip 1.23.169.192
I am on FusionPBX
Please guide.Thanks
Note:i have a valid ext_no and sip uri.Just did not disclose it for security.
To those who voted to close:
This is related to Voip which requires the sip connection to be established between mobile device and server.
The external SIP profile is anonymous and doesn't handle registrations. You would likely want to make a copy of the internal profile say internal-5070 as an example and set the port to 5070. Set the new internal-5070 sip profile with the external sip and rtp IP to use the external IP address. Open up iptables on the local server for SIP port 5070 TCP/UDP and then register the SIP phone to 5070.