Quickblox音频呼叫voip问题

时间:2017-11-09 07:00:56

标签: ios voip quickblox

我在我的应用程序中集成了quickblox,用于像whatsapp这样的音频调用。为此,我使用了VOIP推送通知,因此如果应用程序未运行,用户仍然可以接听电话。

 - (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];

    }

当有人打电话并且用户的应用程序处于后台时,用户可以看到与whatsapp相同的默认呼叫屏幕,如果用户接受呼叫,我的应用程序将启动。

现在问题如下,

  1. 启动应用程序用户时看到屏幕接受来电或拒绝我设计的电话,我无法通过 performAnswerCallAction 进行会话,请告诉我们我可以自动接受来电,因为用户在应用未运行时已接受默认呼叫屏幕上的呼叫

  2. 如果用户拒绝通话应用程序无法打开且 performEndCallAction 将获得触发但是正在通话的人仍然会看到应该被解雇的通话屏幕,所以请同时建议我这样做

  3. 如果用户接受呼叫(默认呼叫屏幕第一次两次,应用程序第二次)并成功完成呼叫,我呼叫 [[QBCore instance] .callkitProvider invalidate]; < / strong>所以callkit(iOS)可以解除呼叫,但那时它还会给出一个屏幕,说明呼叫失败。

0 个答案:

没有答案