4
votes

I think i have all the requirements to have an "alive" socket while the app is in background. That is to say:

  • My application has voip and audio as its background modes.
  • I'm using PJSIP as the SIP library, which is supposed to use CFReadStreams with the "Run in Background" property enabled
  • The app is using TCP to establish the connection with the SIP server.

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 :)

2
I am fetching same problem, how did you solve it. Can you help me please.MaxEcho
How to get incoming call alert or view ?? Please help me out !Devang Goswami

2 Answers

4
votes

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.

0
votes

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.