I just want to say thank you Michael I was able to get this to work :) I configured asterisk to wait for 10 minutes for registration then in my Keep alive function I was unregistering the current account and re register with the same credential and it is working now.. Best Regards, -----Original Message----- From: Ashraf Jaddo Sent: Thursday, February 09, 2012 10:40 AM To: pjsip list Subject: Re: HELP about background mode I started adding the keep alive code. where is app defined in: [app performSelectorOnMainThread:@selector(keepAlive) withObject:nil waitUntilDone:YES]; do you mean instead to use application?? also same for the next line.. about pj_thread_register("ipjsua", a_thread_desc, &a_thread); where do you define a_thread_desc and a_thread? do I have to maintain Thanks, -----Original Message----- From: Ashraf Jaddo Sent: Wednesday, February 08, 2012 7:32 PM To: pjsip list Subject: Re: HELP about background mode Thank you so much for your help.. I understand now what do, I will try this and I will update if I got success.. I was confused because my test TCP socket that I did to test background mode was working without doing any keep alive. and I was getting notified if it received data so I thought PJSIP will do the same automatically. One last question, if my asterisk wants me to keep alive every 60 seconds. what will happened if went to background mode and someone called me in 2 minutes.. this 8 minutes before my 10 minutes keep alive thread.. Best Regards, -----Original Message----- From: Michael Fortson Sent: Wednesday, February 08, 2012 4:09 PM To: pjsip list Subject: Re: HELP about background mode PJSIP wraps the socket, but that's just one part of it. Registrations are kept alive from the client (via the KeepAliveTimeout method), because that's the mobile part -- your IP address will change periodically, and waking up every 10 minutes for a register call is how you tell Asterisk where you are now (plus it's how you keep the SIP registration active). So just make sure you're really getting suspended (as noted before), then make sure you're getting called every 10 minutes to wakeup and re-register -- only after you know those are working should you look further, to make sure the wake-on-incoming-call part is also working. I know you've seen this link, but look at it again: https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW12 -- those first 4 steps are each critical. Wrapping is just one of them. _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip at lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip at lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip at lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org