I apologize if this is not the right place to ask the following questions (or part of them).
What steps will reproduce the problem? Hack the ConnectivityService.java to enable simultaneous support of WiFi and 3G in Android Smartphones, using the way specified in the CSipSimple mobility project as well as in the project COIN project. 1. brutally mask the state handling in the MyHandler 2. set the DNS as the Google public DNS - we tried OpenDNS too 3. replace the old services.jar with the newly custom built one - we also tried building the whole Android source code to make a new rom, and flash the new rom into phones.
What is the expected output? What do you see instead? We expect that CSipSimple will work when WiFi and 3G are both available. The web service is working fine with both WiFi and 3G on (we can browse different kinds of websites). However, CSipSimple is not working under any kind of situations: a) WiFi and 3G on, b) only WiFi on, or c) only 3G on. An error message was shown as "Selected network route not allowed with current settings you have setup".
What version of the product are you using? On what operating system? CSipSimple version 0.02-03 r944 on Android 2.3.6
Please provide any additional information below. We also tried the latest version of CSipSimple. But it is not working even for the official Android OS 2.3.6, without our hack of ConnectivityService.java.
Comment #1
Posted on Dec 10, 2011 by Quick HippoOk. Well I think that the first point would be to understand why it's not working even if you don't change anything to the connectivity service and use a standard phone. You should probably start to use the latest csipsimple version (0.03). Then it's probably a problem of sip provider configuration. You may try to collect and send me some logs (see HowToCollectLogs wiki page).
Then about your problem. I'm not pretty sure to understand what you are trying to do. Correct me if I'm wrong by my understand is that you are trying to modify android in order to be able to use several connection (wifi + 3g in your case) instead of only one.
Well, Since android is a linux based system it should be possible to support that in lower level. There is obvious limitation due to route system and that introduce that you'll need at least one default route gateway in order to send packets outside. You may have several gateway depending on the configuration (but normally, it's not what is recommanded for a client but rather for a access point router that have several connections). So the first point you have to ensure is that * android interfaces for 3G and wifi are up * if you run route -n command on your android you find something coherent with what you want.
Then, you probably already know that android higher software layer actively limit connections to only one at a time. So you have to prevent it from doing that (else it will stop the connection on lower layer).
But, anyway, CSipSimple doesn't care about what android does. It works only at very lower gnu/linux level.
Let me explain what happens when csipsimple try to connect a sip server : 1 - if specific dns are set in csipsimple (there is an option for that) and dns srv option activated. It will connect the dns using dns protocol and ask for domain name resolution if necessary. This is made by opening a socket in native code and basically - as it's done on linux - it will first find the route to send the packet to and send the packets. 2 - it will open a socket to your sip server. And just like previously it will use lower unix socket method. So android higher layer are absolutely not aware about that !
In fact csipsimple rely on a native library that works on linux, windows, macosx, symbian and iphone also. And this library is agnostic about the system and rely on very low socket layers. On linux it's very easy to get several connection up at a time and I already tested the library we use on csipsimple on linux and it just behaves correctly when the linux system is correclty configured.
As consequence, if your android system as a linux system is properly configured to manage several interfaces and route correctly packets to these interfaces, it should be not a problem for csipsimple to manage this kind of configuration. If your hack is a weird hack that only changes the "java" socket in android sdk, it will not work. BTW, there is a lot of other programs that will not work too, and it's a very weird way to handle this situation because you try to modify OSI layer 3 by modifying application/SDK level.
Comment #2
Posted on Dec 10, 2011 by Happy RabbitComment deleted
Comment #3
Posted on Dec 10, 2011 by Happy RabbitThank you for the detailed information. The most useful information is that we need to go through csipsimple and pjsip to find the ways to enable multiple connections. We have used busybox to set and test the route and dns in android system: static dns were set, and the route entries were just the same as the case with single connection for each interface. I thought csipsimple used the route and dns available from android system (a custom system including linux kernel) and just never checked the route operations in pjsip (these routes are all from the same linux kernel anyway? maybe different library). I will update once problem solved.
One thing I want to clarify (in case anybody else has the same issue) is the following: the hack in Android is necessary because by default Android 2.3.6 allows either wifi or cellular data (2.5G, 3G, 4G, you name it), not both. Also, when you say "CSipSimple doesn't care about what android does", here by android you mean Android SDK/apps, not including the linux kernel and low-level modules in Android, right?
Comment #4
Posted on Dec 10, 2011 by Quick HippoYes I mean that csipsimple (actually pjsip), does not care on android SDK layer to use network. Indeed there is parts of linux kernel inside of android that have been modified to do security stuff and to limit what can be done with interface. But it is still a linux based system and native network primitive are still available.
What does pjsip is very basic. It use one of the very lower network layer in the unix system. You may have a look to this functions : http://www.manpagez.com/man/2/connect/ and http://www.manpagez.com/man/2/socket/ . Also : http://www.linuxhowtos.org/C_C++/socket.htm may be useful.
It's the lower C api you'll find about connections. In normal usage, pjsip is not aware of DNS server and of network gateways. This is all managed implicitely by the socket api. There is only one case where I provide DNS server configured in android to pjsip layer and it is when you want to use the DNS SRV (obviously in this case simple name resolution is not enough and pjsip has to make DNS requests by itself). But it's the very only case. For all other connections it has not to be aware of complex things, it just needs to use a standard API which is the socket API.
So basically, if ping or route command works on your android and are able to reach your sip server, there is no reason that could lead pjsip to be lost.
The only things that could break pjsip is the fact that it was not started at correct time and started to establish socket while the network layer were not properly configured yet. For this particular purpose (restarting pjsip when connectivity changed), there is something done on pjsip side. There is some basic monitoring of network changes using android API, there is also something that "tries" to monitor VPN changes (at least the most common implementation). If the problem is about the monitoring of network reachability, and not the actual connection made by pjsip, this is probably the first thing to look at (this part is in csipsimple - you can try to collect and send me logs about that). If the problem appears when pjsip is actually connecting the sip server, the problem is more likely on the fact the lower network api is not properly configured.
Status: Invalid
Labels:
Type-Defect
Priority-Medium