kavithakunduru11 / siphon

Automatically exported from code.google.com/p/siphon
0 stars 0 forks source link

Background app support for iPhones with multitasking support - not jailbraked (Compilation) #515

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When the app enter in background in iPhone 4,

What is the expected output? What do you see instead?
I have configured the project with background mode 'voip', but when the 
application enter in background does not receive incoming calls alerts, when 
I'm on call I can press the home button and continue talking even the app is in 
background.

What version of the product are you using? On what operating system?
iPhone devices that support multi-tasking : iPhone 3GS, iPhone 4, iOS 4.x  , 
(not jailbraked)

Please provide any additional information below.

After successfully compiling and installing the siphon app on my iPhone device 
(not jailbraked)
all if fine except that the application does not receive incoming calls while 
is in background.

The iPhone device supports mutli-tasking as well, I have found a lot of tickets 
regarding this issue at
http://code.google.com/p/siphon/issues/list but I'm still not able to resolve 
my problem

What I'm trying to do is just  a simple phone application based on pjsip and 
siphon.

Can you please tell me how can I add a background support?
and is the background support related to the keepAwake setting and the 
keepAwakeEnabled function?

Thanks in advance

PS: my SIP server supports TCP notifications

Original issue reported on code.google.com by danielve...@gmail.com on 29 Apr 2011 at 4:53

GoogleCodeExporter commented 8 years ago
Sorry, after publishing this ticked I have fond that the same issue is already 
reported here :
http://code.google.com/p/siphon/issues/detail?id=505

The answer is the we should "enable the background support" and re-run the 
application, can someone please tell me how can I enable the background support?

and is the background support related to the keepAwake setting and the 
keepAwakeEnabled function?

Thanks in advance

Original comment by danielve...@gmail.com on 29 Apr 2011 at 4:57

GoogleCodeExporter commented 8 years ago

Original comment by samuelv0...@gmail.com on 4 May 2011 at 11:31

GoogleCodeExporter commented 8 years ago

Original comment by samuelv0...@gmail.com on 28 May 2011 at 7:59

GoogleCodeExporter commented 8 years ago
regarding this specific problem, i read an official document here --> 
http://developer.apple.com/library/ios/#technotes/tn2277/_index.html  which 
says that if you tag the data socket as "VoIP", they can still receive data 
while in background and put in foreground the application.

So, why can not be done in Siphon, since it is a VoIP app??

Original comment by onepiece...@gmail.com on 15 Jul 2011 at 6:03

GoogleCodeExporter commented 8 years ago
Moreover, it should work with both UDP and TCP... 

Original comment by onepiece...@gmail.com on 15 Jul 2011 at 6:04

GoogleCodeExporter commented 8 years ago
Thanks a lot for your help !
You can enable this feature in settings (Phone advanced settings).
You have to know two things:
  - network backgrounding works with TCP only
  - several SIP providers accepts UDP connection only

Original comment by samuelv0...@gmail.com on 16 Jul 2011 at 6:28

GoogleCodeExporter commented 8 years ago
Why TCP only? Apple says that it is sufficient to tag a data socket as "VoIP" 
and it should work (so even with UDP). SIP "is" voip, so why cannot this be 
applied in siphon? I need to understand definitely this problem.

Last: i use Siphon2. Do i need to recompile with Siphon4 to have Phone advanced 
settings?

Thanks

Original comment by onepiece...@gmail.com on 16 Jul 2011 at 4:36

GoogleCodeExporter commented 8 years ago
In order to have one iPhone VoIP application:

1. Add the following property into the application Info.plist file :
Required background modes =  App provides Voice over IP services

with source code look like this :
<key>UIBackgroundModes</key>
    <array>
        <string>voip</string>
    </array>

2. Scroll down to : Implementing a VoIP Application 
http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOS
ProgrammingGuide/BackgroundExecution/BackgroundExecution.html

Or with example (how to configure the sockets : input/output streams):
<code>
[input setProperty: NSStreamNetworkServiceTypeVoIP 
forKey:NSStreamNetworkServiceType];
[output setProperty: NSStreamNetworkServiceTypeVoIP 
forKey:NSStreamNetworkServiceType];  

CFReadStreamSetProperty((CFReadStreamRef)input, kCFStreamNetworkServiceType,
kCFStreamNetworkServiceTypeVoIP);
CFWriteStreamSetProperty((CFWriteStreamRef)output, kCFStreamNetworkServiceType, 
kCFStreamNetworkServiceTypeVoIP);
</code>

Original comment by danielve...@gmail.com on 17 Jul 2011 at 12:20

GoogleCodeExporter commented 8 years ago
also you may want to take a look of this : PJSIP : iPhone: Add support for 
Apple iOS4 background feature
https://trac.pjsip.org/repos/ticket/1107

Original comment by danielve...@gmail.com on 17 Jul 2011 at 12:23

GoogleCodeExporter commented 8 years ago
Also PJSIP developers claim that only TCP sockets could listen in background.

But, again, Apple doesn't specify this constrain. It's very strange that no one 
has developed a background feature for VoIP over UDP (without jailbreak 
obviously).

Original comment by onepiece...@gmail.com on 17 Jul 2011 at 3:06

GoogleCodeExporter commented 8 years ago
I've already specified background modes in Info.plist  for both audio and voip. 
But nothing has changed.
I need more time to investigate which specific sockets in Siphon do I need to 
set background property.

Original comment by onepiece...@gmail.com on 17 Jul 2011 at 3:12

GoogleCodeExporter commented 8 years ago
i can definitely say that you CAN put in background the application with UDP 
and still receive INCOMING calls with a popup notification.

Download Linphone from the Appstore and you'll get it

Original comment by onepiece...@gmail.com on 29 Jul 2011 at 10:47

GoogleCodeExporter commented 8 years ago
Fine, and do you know how they do it ?

Original comment by samuelv0...@gmail.com on 29 Jul 2011 at 11:18

GoogleCodeExporter commented 8 years ago
I need to investigate. Firstly they set the background mode for both voip and 
audio in info.plist (as I did with siphon but with no success). And probably 
they also set the listening sockets as voip, as explained in the Apple 
documentation.

You can however download the source code since it's GPL.

Original comment by onepiece...@gmail.com on 29 Jul 2011 at 12:23

GoogleCodeExporter commented 8 years ago
linphone is not working in background mode on iOS 4.3.1, 4.3.2, 4.3.3 as 
reported and verified with my iPhone 4 with 4.3.3
This the linphone's discussion about the same issue.
http://lists.gnu.org/archive/html/linphone-developers/2011-04/msg00034.html
But it seems linphone doesn't have a good solution instead using TCP now.
Bria which is the product of CounterPath is working under those iOS version 
which they seems using udp keep alive.

Original comment by jjk...@gmail.com on 18 Aug 2011 at 4:55

GoogleCodeExporter commented 8 years ago
Yes, unfornately I can confirm. :(
I tried with 4.2.1 and effectively it works with UDP traffic even in background 
(e.g. during phone ringing) and the receiving iPhone rings...

But is it a new limitation of the operating system? Is it not longer possible 
tagging the sockets as "voip" and mantain them active??

What do you mean exactly with "UDP keep alive" ? 

Original comment by onepiece...@gmail.com on 29 Aug 2011 at 1:55

GoogleCodeExporter commented 8 years ago
I tried Media5 which is also free and UDP background works correctly with iOS 
4.3.4 exploiting "an undocumented trick" says the developers...

Original comment by onepiece...@gmail.com on 5 Sep 2011 at 5:40

GoogleCodeExporter commented 8 years ago
There is other app called Bria, according to them, it uses the UDP too. 
http://comments.gmane.org/gmane.comp.voip.pjsip/14013

Other "an undocumented trick" ?

Original comment by blitz...@gmail.com on 16 Sep 2011 at 11:02

GoogleCodeExporter commented 8 years ago
did you tested it? does it work without any time limit? 

Original comment by onepiece...@gmail.com on 19 Sep 2011 at 9:00

GoogleCodeExporter commented 8 years ago
I'm pretty sure that without playing continuously an audio file or logging GPS 
position you cannot keep alive UDP listening sockets in iOS 4.3+ (both in the 
main thread or in a secondary one).  If you play an audio play with 
AVAudioPlayer (after initializing an AudioSession before) in a nsrunloop every 
5 seconds, the main thread is kept active and moreover it's NOT necessary to 
declare the audio background support in info.plist.

I think this is the "trick" used by Media5 and Bria. 
I tried also creating a infinite TCP stream to the loopback interface declaring 
it as VoIP, just to see if also UDP socket is kept alive. The answer is no, 
only TCP sockets works while in background (and with screen locked), UDP is 
closed in the meanwhile and cannot listen for incoming calls anymore.

So the key point is that the main thread must be kept active... using a simple 
nstimer o infinite runloop alone is useless, since the watchdog kills the 
process after few seconds in background (except if you work in debug mode with 
GDB interface attached, it runs forever).

Original comment by onepiece...@gmail.com on 24 Oct 2011 at 9:50

GoogleCodeExporter commented 8 years ago
Any progress with this?

Thanks

Original comment by danielve...@gmail.com on 8 Nov 2011 at 6:12

GoogleCodeExporter commented 8 years ago
Hi,

could any one get this to work, appreciate if you can provide the solution 
here, will benefit many like me.

Regards,

Original comment by raomadhu...@gmail.com on 31 Jan 2012 at 9:48