4
votes

I am developing a iOS (7 & 8) VOIP application (By using Kamailio server and PJSIP device library).

Everything works fine when application is in foreground, but the issue is when application is in background, the socket will remain alive for only 5 minute (300 sec).
When I am registering with:

[application setKeepAliveTimeout:600 handler: ^{
        [self performSelectorOnMainThread:@selector(keepAlive) withObject:nil waitUntilDone:YES];
    }];

I am able to get the call.

The issue is setKeepAliveTimeout is 10 minutes and socket only persists for 5 minutes.

I enabled "App provides Voice over IP services" in .plist. I also set PJSUA_REG_INTERVAL to 600 seconds.
Please help me set the VIOP socket in PJSIP.

2
followed the link i think you will get answer. stackoverflow.com/questions/28028682/…Jatin Patel - JP
I already did this, but no luck.Uttam Kadam
How I cna use CFReadStreamRef in PJSIP?Uttam Kadam
I am getting error: Received 50 consecutive errors: 120035 for the accept() operation, stopping further ioqueue accepts.Uttam Kadam

2 Answers

0
votes

Did you try assigning the VoIP property to the Stream as below,

CFReadStreamSetProperty((__bridge_retained CFReadStreamRef)iStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
0
votes

NAT of some Internet providers shutdown inactive sockets after a few minutes of silence.

It's possible to activate internal keep-alive messages for sockets in the PJSIP with following code:

pjsip_cfg()->tcp.keep_alive_interval = 90;
pjsip_cfg()->tls.keep_alive_interval = 90;

And of course you have to set up iOS keep-alive timer.