Author Message
RogerLi
Joined: Mar 25, 2017
Messages: 10
Offline
Hi Experts,

I am encountering a very strange issue about CSDK iOS background mode. When I push the home button on my iPhone 6(iOS9.2), from this time, I cannot receive any incoming call, even I cannot get any incoming call event on my Xcode console. The mobile application for my testing is sampApp for CSDK iOS, release 3.0.0.1, which is downloaded from Devconnect. Can anyone give some advice for this issue? Here I post the Xcode console output at the time I push the home button.

By the way, I noted that there is one function in CSDK API may be related about the background mode support. I attached the screenshot for the API reference to this post. If this is the way to solve the problem, is there any specific configuration should be done on CM or SM?


2017-03-24 16:25:29.250 CommunicationSampleApp[4634:1386355] CSSystemEventsMonitor::enteredBackground()
2017-03-24 16:25:29.250 CommunicationSampleApp[4634:1386355] CSystemEventsProvider::NotifyApplicationNotVisible()
2017-03-24 16:25:29.250 CommunicationSampleApp[4634:1386355] CSCellularCallMonitor::enterBackground
2017-03-24 16:25:29.253 CommunicationSampleApp[4634:1386805] CCollaborationManager::OnApplicationNotVisibleNotificationReceived() this[0x174365880] :
2017-03-24 16:25:29.253 CommunicationSampleApp[4634:1386805] CCallServiceImpl::OnApplicationNotVisibleNotificationReceived()
2017-03-24 16:25:29.253 CommunicationSampleApp[4634:1386805] ThreadId[0x16e687000] COperatingMeasurementsCollector::OnApplicationNotVisibleNotificationReceived()
2017-03-24 16:25:29.253 CommunicationSampleApp[4634:1386805] ThreadId[0x16e687000] COperatingMeasurementsCollector::OnApplicationNotVisibleNotificationReceived() OM: Collection Timer has been adjusted to backgound mode : 1800 (s)
2017-03-24 16:25:29.254 CommunicationSampleApp[4634:1386805] CPresenceServiceImpl::OnApplicationNotVisibleNotificationReceived()
2017-03-24 16:25:29.254 CommunicationSampleApp[4634:1386805] CSIPPresenceManager::OnApplicationNotVisibleNotificationReceived()
2017-03-24 16:25:29.254 CommunicationSampleApp[4634:1386805] CSIPPresenceManager::ApplicationVisibilityChanged()
2017-03-24 16:25:29.260 CommunicationSampleApp[4634:1386805] CPresenceServiceImpl::StartAwayPollingTimer()HasCalls:false SelfPresence:0 ForceStart:false
2017-03-24 16:25:29.260 CommunicationSampleApp[4634:1386805] CPresenceServiceImpl::StartAwayPollingTimer()started with timeout:600000 ms
2017-03-24 16:25:29.278050 CommunicationSampleApp[4634:1386355] Cannot snapshot view (<UIKeyboardImpl: 0x102b24ac0; frame = (0 0; 320 216); layer = <CALayer: 0x174031940>>) with afterScreenUpdates:NO, because the view is not in a window. Use afterScreenUpdates:YES.

  • [Thumb - backgroundmode.png]
[Disk] Download
Pavel_K
Joined: Dec 20, 2016
Messages: 67
Offline
The Sample app doesn't support background mode because it has been simplified to show CSDK abilities. If you need it, you can check how to create voip background application for iOS and make it.

About the logs: CSDK sets "Away" presence when the app goes into background to notify other users that you are not available.
RogerLi
Joined: Mar 25, 2017
Messages: 10
Offline
I have ever tried to enable voip capability for the background mode. But in the customer environment, the problem stays the same as before. Please check the attached screenshot. Do you have any advice?
  • [Thumb - ???? 2017-03-28 ??7.46.51.png]
[Disk] Download
Pavel_K
Joined: Dec 20, 2016
Messages: 67
Offline
It is not enough. You need to implement BackgroundTask. For example you can use this solution: http://stackoverflow.com/a/11809211
RogerLi
Joined: Mar 25, 2017
Messages: 10
Offline
I have checked the solution, it looks a common solution for VoIP backgroundtask implementation. I am not quite sure if there is any specific code I should implement for the CSDK connection to Aura CM/SM. Customer plan to put the solution on production from next Monday, so the time is very limited for us to guide our customer how to implement CSDK background working mode. Can you give me some example code for our CSDK implementation, so that I may try it as soon as possible in our lab environment?
Pavel_K
Joined: Dec 20, 2016
Messages: 67
Offline
Please check this doc:
https://www.devconnectprogram.com/site/global/products_resources/avaya_client_sdk/programming_docs/current/ios/communication/tech/backgrounding.gsp

Note that backgrounding in 3.1 CSDK release is not supported for iOS 10 if you have compiled the project using iOS10 target, so you need to compile using iOS9 target if you want background support.
RogerLi
Joined: Mar 25, 2017
Messages: 10
Offline
Thank you! It works. I added some codes as following:

AppDelegate.h

@property (nonatomic, strong) CSClient *client;


AppDelegate.m

- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
[application setKeepAliveTimeout:UIMinimumKeepAliveTimeout handler:^{
[self.client prepareForBackgroundInterval:UIMinimumKeepAliveTimeout];
}];

MediaManager.h
#import "AppDelegate.h"

MediaManager.m

- (id)initWithClient: (CSClient *)client {
if (self = [super init]) {
_appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
_appDelegate.client = self.client;
}
return self;
}

But I found, when the iOS demo app went to background for a while, it can receive SIP invite message, but it do not ring anymore. Is it a bug? Because for at the first minute it turns to background, it do ring when receive SIP invite. Can anyone give me some advice?
Rumata
Joined: Dec 20, 2016
Messages: 133
Offline
As I see the separate topic was created for ringing issue. Let's discuss it there.
https://www.devconnectprogram.com/forums/posts/list/20865.page

Go to:   
Mobile view