I am testing a Voip sip client written by an iphone app developer that uses PJSip. I personally have toyed around with some SIP development myself but am no expert.
With our VOIP softswitch (Acme packet / Broadsoft), it takes care of all the Nat Handling by dynamically determining the best Re-register time to keep the Nat pinhole alive on the nat device. Typically when the iphone is behind a NAT this time is between 60-90 seconds.
The Iphone App is using TCP and happily works with Backgrounding. Obviously backgrounding is ideal to save on the battery life. The call wakes up the phone and you can listen to the call.
The problem is that when the App goes into Background mode, it has no way of keeping the Nat Pinhole open. This means the firewall will always reject new incoming calls from reaching the Iphone App once the pinhole is closed. This has the affect of incoming calls working to the app for a few minutes, then not working for a period, and then when the app comes out of background and registers again, the inbound calls work again.
According to the apple documentation: http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW3
They have inbuilt special exceptions for voip applications for backgrounding we can: 1. Configure the Apps sockets such that they can still handle incoming messaging. This doesn't help as the messaging will never reach the app if the nat pinhole is closed. 2. Use a Keep alive, however the minimum time is 600 seconds. This also means the pinhole will close.
Is there some clever way an App can send a Voip Sip registration message, say every 60 seconds or so whilst remaining in the background. Or can the app wake up every 60 seconds do some work and then close.
Im really perplexed as to whether or not there are other sip apps on the market that have got around this problem.