forked from mirrors/linphone-iphone
add bg long running task for a refer received
This commit is contained in:
parent
63b6510d2f
commit
dbdf49a3af
3 changed files with 24 additions and 10 deletions
|
|
@ -441,12 +441,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||
if ([loc_key isEqualToString:@"IC_MSG"])
|
||||
[LinphoneManager.instance startPushLongRunningTask:FALSE callId:callId];
|
||||
else if ([loc_key isEqualToString:@"IM_MSG"])
|
||||
[LinphoneManager.instance startPushLongRunningTask:TRUE callId:callId];
|
||||
}
|
||||
if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive)
|
||||
[LinphoneManager.instance startPushLongRunningTask:loc_key callId:callId];
|
||||
|
||||
// if we receive a push notification, it is probably because our TCP background socket was no more working.
|
||||
// As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
Connectivity connectivity;
|
||||
UIBackgroundTaskIdentifier pausedCallBgTask;
|
||||
UIBackgroundTaskIdentifier incallBgTask;
|
||||
UIBackgroundTaskIdentifier pushBgTaskRefer;
|
||||
UIBackgroundTaskIdentifier pushBgTaskCall;
|
||||
UIBackgroundTaskIdentifier pushBgTaskMsg;
|
||||
CTCallCenter* mCallCenter;
|
||||
|
|
@ -143,7 +144,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (LinphoneCall *)callByCallId:(NSString *)call_id;
|
||||
- (void)cancelLocalNotifTimerForCallId:(NSString*)callid;
|
||||
- (void)alertLIME:(LinphoneChatRoom *)room;
|
||||
- (void)startPushLongRunningTask:(BOOL)msg callId:(NSString *)callId;
|
||||
- (void)startPushLongRunningTask:(NSString *)loc_key callId:(NSString *)callId;
|
||||
+ (BOOL)langageDirectionIsRTL;
|
||||
+ (void)kickOffNetworkConnection;
|
||||
- (void)setupNetworkReachabilityCallback;
|
||||
|
|
|
|||
|
|
@ -2142,8 +2142,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
[[UIApplication sharedApplication] backgroundTimeRemaining]);
|
||||
}
|
||||
|
||||
- (void)startPushLongRunningTask:(BOOL)msg callId:(NSString *)callId {
|
||||
if (msg) {
|
||||
- (void)startPushLongRunningTask:(NSString *)loc_key callId:(NSString *)callId {
|
||||
if ([loc_key isEqualToString:@"IM_MSG"]) {
|
||||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskMsg];
|
||||
pushBgTaskMsg = 0;
|
||||
pushBgTaskMsg = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
|
||||
|
|
@ -2174,7 +2174,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
}];
|
||||
LOGI(@"Message long running task started for call-id [%@], remaining [%g s] because a push has been received",
|
||||
callId, [[UIApplication sharedApplication] backgroundTimeRemaining]);
|
||||
} else {
|
||||
} else if ([loc_key isEqualToString:@"IC_MSG"]) {
|
||||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskCall];
|
||||
pushBgTaskCall = 0;
|
||||
pushBgTaskCall = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
|
||||
|
|
@ -2205,6 +2205,23 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
}];
|
||||
LOGI(@"Call long running task started for call-id [%@], remaining [%g s] because a push has been received",
|
||||
callId, [[UIApplication sharedApplication] backgroundTimeRemaining]);
|
||||
} else if ([loc_key isEqualToString:@"IC_SIL"]) {
|
||||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskRefer];
|
||||
pushBgTaskRefer = 0;
|
||||
pushBgTaskRefer = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
|
||||
// Could be or not an error since the app doesn't know when to end the background task for a REFER
|
||||
// TODO: Manage pushes in the SDK
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive)
|
||||
LOGI(@"Incomming refer long running task with call-id [%@] has expired", callId);
|
||||
|
||||
for (NSString *key in [LinphoneManager.instance.pushDict allKeys]) {
|
||||
[LinphoneManager.instance.pushDict setValue:[NSNumber numberWithInt:0] forKey:key];
|
||||
}
|
||||
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskRefer];
|
||||
pushBgTaskRefer = 0;
|
||||
}];
|
||||
LOGI(@"Refer long running task started for call-id [%@], remaining [%g s] because a push has been received",
|
||||
callId, [[UIApplication sharedApplication] backgroundTimeRemaining]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue