VOIP app behavior at background (iOS 4.0+):
Having a single socket that remains open, flagged as Voip
This VOIP socket is maintained by the system, while app suspended at BG
You may schedule a keep-alive block, and the OS will wake your app every X time
X >= 10min (See [[UIApplication sharedApplication] setKeepAliveTimeout: handler:)
this socket is NOT the media socket, it uses only to receive invitations for incoming calls
App wake up on every incoming data on the socket (iOS 5.0+ limit is 15 times in 300 seconds)
Once you've received an incoming call, your app will wake up, and you may open an Audio Session for this call.
VOIP apps should be flagged at info.plist, under "Required background modes",
as "voip" & "audio".
Once you've opened an Audio Session (For active call),
your app may run fully at the background and it is no longer suspended,
until this Audio Session is closed.
Anyway, the other alternative, is to use Push notifications as triggers for incoming calls.
Also, this will save you the trouble of maintaining a socket 24/7, save some battery,
and will work even if the user has closed the app (which is not the case with the first alternative).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…