Direct IP call android - android

Im creating an Android App in which the clients can call each other without using a SIP proxy (server).
I downloaded the CSipSimple, it has a "local" option in which the clients in a local network can call each other directly.
What if I am connected to the mobile network. If i know the public IP of the destination, can I call him direclty?
If you can suggest another applications that fulfill the mentioned requirements please do mention them.
thanks

Yes, you should be able to make direct call with almost all SIP clients. I am using mizudroid and works with that.
In this case, you just need to enter the full URI for the destination and not just the extension name.
So instead of calling to "john" you will have to enter
john#ipaddress:port
Example:
john#192.168.1.33:14321
Some sip clients might require to prefix all these with "sip:":
sip:john#192.168.1.33:14321
As you can see, the tricky part is to find out the correct port. SIP clients are using random local ports by default, but some of them allows you to set the port explicitly. (Don't be confused with the server sip signaling ports which is usually 5060 after the SIP standards.)
Also please note that the role of a sip registrar is exactly this: so you don't have to play finding out the peer's exact address as the server can handle this for you automatically.
Some sip clients might require to enter a sip server address in settings/login, however most of them allows you to use the softphone without any address entered or they have an option to specify serverless/local/registerless or you might just enter a fake address (then the softphone might display "register failed" but you should be able to make direct calls as i have described above)

I had the same issue with how to connect 2 android devices via VPN without PBX server.
So, after establishing a VPN connection we were using Linphone app
Just click settings and disable the random port.
If you need to call another device, just type sip:device_remote_IP_addres on the dial pad and click enter.
For example, sip:192.168.1.2

Related

Add dial/receive signalling mechanism for AppRTCDemo at client side

Hi I am using AppRTCDemo and its working on their server. How ever the current mechanism is for exchanging chat-rooms name and entering the same room connects the peers.
But I want to dial a call from one device to receive a call from other device and then peers should enter a room for video session ,
I have searched a lot , I have come up with for that I need signalling-server which I don't have and don't want to put hands on it ,
Now in this situation how can the other device know that device one is dialing and sharing particular room name to accept and enter the same room for video call at client side in Android .
https://github.com/njovy/AppRTCDemo
There are two android apk available for WebRTC, appRtcDemo and webRtcDemo. appRtcDemo apk can be used for android device to browser connectivity. You need to provide room id to connect to one room. If you are the room initiator then you have to enter -1.
If you want to connect two android device then you have to compile and install webRtcDemo apk. This apk interface provide place to enter ip address of another device and vice versa then both device will be connected.
Please go through -> http://www.webrtc.org/reference/getting-started
For more information. Both the apks i've compiled and installed and checked how it works.
I was able to make calls successfully between two android device using webrtcdemo. But I tested using WLAN of my office network. I did not use it further because I was using apprtcdemo for app reference. My suggestion is when you enter remote ip in webrtcdemo,just check if loop-back is unchecked. I guess for you loop-back is enabled, so you are receiving your own video packet, though you have entered remote ip. Make sure loop-back is disabled while making call.
A very good explanation can be found in this book http://chimera.labs.oreilly.com/books/1230000000545/ch03.html#STUN_TURN_ICE
which provides the fundamentals on how WebRTC uses ICE technology.
In particular assuming the IP address of the STUN server is known, the WebRTC application first sends a binding request to the STUN server. The STUN server replies with a response that contains the public IP address and port of the client as seen from the public network.
Now the application discovers its public IP and port tuple which can send to the other peer through SDP. (note that SDP are sent over an external signalling channel, f.i. websocket established through a web service)
With this mechanism in place, whenever two peers want to talk to each other over UDP, they can then use the established public IP and port tuples to exchange data.
Unfortunately, in some cases UDP may be blocked by a firewall. To address this issue, whenever STUN fails, we can use the Traversal Using Relays around NAT (TURN) protocol as a fallback, which can run over UDP and switch to TCP if all else fails.
WebRTC gives SDP Offer to the client JS app to send (however the JS app wants) to the other device, which uses that to generate an SDP Answer.
The trick is that the SDP includes ICE candidates (effectively "try to talk to me at this IP address and this port"). ICE works to punch open ports in the firewalls; though if both sides are symmetric NATs it won't be possible generally, and an alternative candidate (on a TURN server) can be used.
Once they're talking directly (or via TURN, which is effectively a packet-mirror), they can open a DTLS connection and use it to key the SRTP-DTLS media streams, and to send DataChannels over DTLS.
Edit:
Acronyms here: http://blog.1click.io/10-jargons-abbreviations-for-webrtc-fans/ for the rest, there is Google. Most of these are defined by the IETF (http://ietf.org/)
Edit 2:
Firefox and Chrome (and the spec) have moved to using "trickle" for ICE candidates, so the ICE candidates are generally added after-the-face to the PeerConnection and exchanged independently of the initial SDP (though you can wait until the initial candidates are ready before sending an offer, and bundle them together).
See https://webrtcglossary.com/trickle-ice/ and https://datatracker.ietf.org/doc/draft-ietf-ice-trickle/

Sending a message to a router's IP address?

I am trying to make an Android app that is supposed to send messages between two clients via their IP address.
I currently have a set up that enables a server that runs in the background that listens for incoming messages and its address is the device's IP address. However, I am not able to reach this server unless both devices are connected to the same network.
I want to know if there was a way to send the message to the router, which will then send the message to the specified device via its port number or another specifier, instead of sending the message directly to the device's IP address.
I have been searching and found that some instant messaging programs have a similar kind of set up and I read that Net Send used to do a similar job in previous versions of Windows. I have not been able to find anything that relates to doing this on Android though. At this point, I just want to know if this is possible and if someone could guide me in the right direction. I am just not sure if this idea is possible.
I want to try my best not to have a single dedicated server that all messages are sent to, then from there the server distributes the messages appropriately. I would rather have each device run its independent server in the background so it can be reached from any other device globally.
One way to accomplish this is to set up port forwarding on the router for the server hosting this application.
There may be complications, depending on how the application works. If it does use broadcasts, you are not going to be able to get it to work as you have described. If the application uses an IP address and port, then port forwarding on the server's router will probably work, but you may need to adjust settings in any firewall protecting the server.

How to block/disconnect clients connecting/connected to an open wifi hotspot (android)?

I was able to create an open wifi hotspot in Android 2.2 programmatically and to read out the ip and mac of the connected clients using the ARP-File: code here
Now I would like to find a way to restrict the use of the wifi hotspot. I want to use an open network and not set up any key. Either it should be possible to block certain clients (maybe mac filtering) or disconnect already connected but unauthorized clients. The idea is to send messages to the hotspot through a wifi connection. Some clients should be allowed to access the hotspot others not. How can I develop something like that? I would appreciate your help or suggestion.
Use mac filtering could be an option but the clients can always change his mac address, and with this method you only can block if the client is going to connected. If you like to disconnect clients you need use deauth packets.
There is an app in android call wifikill to send deauth packets.
http://forum.xda-developers.com/showthread.php?t=1282900
In this app you select the clients that you would like to disconnect and the android device will perform a deauth attack.
You could try to develop something but this app works successfully to me.
But if you use an open network will be very tricky to control access even thougth you deauth the clients they always can change theirs macs and try to look like a legitimate user. You will never have 100% control of the clients in an open network.
You can do it by mac address using the existing Android SoftApConfiguration.Builder#setBlockedClientList (link).
More info on this can be found on the official docs here.
Implementing allow and block lists
A typical carrier requirement is to provide the user with controls of
the devices that are allowed to associate to the Soft AP. There are
several mechanisms to do this:
...
Provide dynamic control using allow and block lists:
The default configuration of a Soft AP allows all devices to associate
to the soft AP except for devices whose MAC addresses are added to
SoftApConfiguration.Builder#setBlockedClientList. ...

How to connect to a computer without public IP?

I have a simple app idea in my mind and I need to know how to connect from an Android application (client) to a Windows application (Delphi, server).
There is no need to be specific about the platform, I am familiar with networks in Delphi using winsock or Indy and I'm sure I will be able to figure out the appropriate mechanism in Android.
What I need to know is how to connect to a server (computer), which doesn't have its own public IP and is not in the same network as the client (one can be behind a local router, while the other might be connecting to the internet through 3G, for instance). This should be possible, as many programs work like that (remote desktop programs, TeamViewer, for instance: one computer is assigned an ID and using this ID other computer can connect to it.) I will not have access to the routers behind which the app will be running, so port forwarding is not an option.
I have a working network app, but that only works in LAN, so I'm guessing somewhat another approach is needed.
Thanks for answers
Many of the programs that work that way still use a server with a public IP. Each side of the client connections to the server to say "here I am". The public server can then shuffle data between the two clients.
That still leaves a lot of questions regarding the communication between the public server and each client - i.e. pull vs. push for taking data that was sent to the server and getting it back down to the second client.
You may want to read the specification for Copilot (originally named Project Aardvark). Joel Spolsky published the specification when the started the project. It talks about their use of a reflector service.
The Reflector
A Windows Service which we run on our servers, used to
allow any helper to help any victim even when both of them are behind
firewalls. Both helper and victim connect to the reflector. The
reflector checks that they are authorized and relays messages between
helper and victim until the paid-up time runs out
you could put an intermediate server which they can both route for "nat traversal".
otherwise you will have to put port forwarding on one of those computer's local router to allow incoming connections to be forwarded to the computer.

ANDROID - Displaying a list of IP addresses of phones running same app

I am developing a multi threaded client-server Android app in which both clients and the server are android phones( the server is not centrally located) and are located in the same network, under the control of one single router.
The server will start the application first. When the clients starts the app, they should get the IP address of the server phone automatically, so that when they click the address, they can be connected to the server.
Right now, I have made a provision that the server phone displays its IP address on the screen when the app starts running. When a client starts the app, it is provided with a text field in which the user can manually type the server's IP address and get connected to it.
Can anyone give me any pointers on how I can get the server's IP address to be displayed on the client phone automatically? Do I need a central database or something like that? I am new to android programming and don't really have any idea about this.
See if this is useful: Android IP address with java
You might want to think about implementing a UPnP solution. See this Universal Plug and Play as a starter then check the links at the end for relevant docs/references.
UPnP doesn't require devices to explicitly know the network details of other devices and instead they locate each other using a discovery protocol (SSDP).
One solution is to ping local IP range in a loop. Put a small timeout duration. It would be better if you run it in separate threads. If you get ping response, this would mean the server is available.

Categories

Resources