Receiving voip calls while application is in background in ios
I think i have all the requirements to have an "alive" socket while the app is in background. That is to say:
When the application is sent to background, it adds a background handler which sends a "keepAlive" message each period of time.
That keepAlive seems to be working. If I check the logs in the server I can see how messages arrive even when the application is not in foreground.
The problem ( and the question ) is, I'm not receiving calls while the application is in background.
It seems that the socket is still alive, if I make a call to the cell phone while the app is no in the foreground, nothing happens, but if I launch the app by myself, the call is automatically detected.
Thanks :)
We found the problem.
Given the current configuration, the Server used a different connection to send the INVITE request from the initial TCP socket used from the phone to send the intial REGISTER request.
As the two sockets were different, the Operating System didn't wake the application.
If you configure the server (Kamailio in our case) to reuse the initial socket which the phone used to send the first REGISTER it works seamlessly.
By default, it seems that the SIP servers create new sockets for each INVITE request they want to send to the phone. This situation IS a problem to iphone background model.
Just to double-check, you've read this: http://trac.pjsip.org/repos/wiki/Getting-Started/iPhone#UnabletoacceptincomingcallinbackgroundmodeiOS4
Also, try it with the latest 1.x branch from Subversion repository, there have been several fixes to iOS support.
链接地址: http://www.djcxy.com/p/62862.html上一篇: 每次通话结束后,在iOS中调用应用程序