3

I had integrated quickblox in my application for the audio call like whatsapp. For this i had used VOIP push notification so if app is not running user can still receive call.

 - (void)pushRegistry:(PKPushRegistry *)registry
    didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
                 forType:(NSString *)type {
        UIApplicationState state = [[UIApplication sharedApplication] applicationState];
        if (state == UIApplicationStateActive)
        {
            //Do checking here.
        }else{

        NSString *str = [NSString stringWithFormat:@"didReceiveIncomingPushWithPayload: %@", payload.dictionaryPayload];
        CXHandle *myHandler = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:@""];

        CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
        callUpdate.remoteHandle = myHandler;
        callUpdate.supportsDTMF = NO;
        callUpdate.supportsHolding = NO;
        callUpdate.supportsGrouping = NO;
        callUpdate.supportsUngrouping = NO;
        callUpdate.hasVideo = NO;

        callUpdate.localizedCallerName = [[payload.dictionaryPayload objectForKey:@"custom"] objectForKey:@"Name"];

        CXProviderConfiguration * configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:AppName];
        self.callkitProvider = [[CXProvider alloc] initWithConfiguration: configuration];
        [self.callkitProvider setDelegate:self queue:nil];

        [self.callkitProvider reportNewIncomingCallWithUUID:[NSUUID UUID] update:callUpdate completion:^(NSError * _Nullable error) {
            if(error){
                NSLog(@"error on callkitProvider");
            }else{
                NSLog(@"accepted call on callkitProvider");
            }
        }];

        NSLog(@"%@", str);
        }
    }

    - (void) provider: (CXProvider *)provider
    performAnswerCallAction : (CXAnswerCallAction *)action
    {
        NSLog(@"call accepted");

        NSDate *now = [NSDate date];
        [action fulfillWithDateConnected: now];
    }

    - (void) provider: (CXProvider *)provider performEndCallAction: (CXEndCallAction *)action {

        NSLog(@"call Rejected");

        NSDate *now = [NSDate date];
        [action fulfillWithDateEnded: now];

    }

By doing so when someone calls and user's app is in background user can see default calling screen same as whatsapp and if user accept call my application will launch.

Now the problem is as below,

  1. on launching the application user see screen to accept the call or reject the call which was designed by me and i can't get the session in performAnswerCallAction so let me know how can i accept the call automatically as user has already accepted call on default calling screen when app is not running

  2. In case user reject call app will not open and performEndCallAction will get trigger but the person who is calling still see the calling screen which should have to be dismissed so please also suggest me how to do that

  3. in case user accept call (two times first in default calling screen and second time from the app) and successfully finish the call at that time i call [[QBCore instance].callkitProvider invalidate]; so callkit(iOS) can dismiss the call but at that time it also give one screen stating call failed.

aydinugur
  • 1,208
  • 2
  • 14
  • 21
Akash Raghani
  • 557
  • 1
  • 9
  • 21
  • Also when screen is lock the call (from callKit) display and when user accept the call app is not opening so actually qb call has never started in this case there is no call but os thinks there is a call so is there any way to answer qb call accept in - (void) provider: (CXProvider *)provider performAnswerCallAction : (CXAnswerCallAction *)action in the quickblox document it is not mentioned anywhere – Akash Raghani Nov 09 '17 at 11:03
  • Did you found any soln ? – Shrikant K Mar 13 '18 at 09:43

0 Answers0