如何在VOIP呼叫断开后关闭Callkit屏幕

时间:2017-07-25 11:36:50

标签: ios voip pjsip callkit pushkit

一旦我的voip呼叫被源或目的地断开,我试图删除callkit屏幕。

我使用了这段代码

let label = UILabel()
let stringValue = "Sample text"
let attrString = NSMutableAttributedString(string: stringValue)
attrString.addAttribute(NSKernAttributeName, 2: style, range: NSRange(location: 0, length: stringValue.characters.count))
label.attributedText = attrString

但它无法关闭callkit。任何人都可以帮我解决这个问题吗?

2 个答案:

答案 0 :(得分:2)

您可以在呼叫断开连接方法上使用以下方法。

@property (nonatomic, strong) CXCallController *callKitCallController;

- (void)performEndCallActionWithUUID:(NSUUID *)uuid {
    if (uuid == nil) {
        return;
    }

    CXEndCallAction *endCallAction = [[CXEndCallAction alloc] initWithCallUUID:uuid];
    CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endCallAction];

    [self.callKitCallController requestTransaction:transaction completion:^(NSError *error) {
        if (error) {
            NSLog(@"EndCallAction transaction request failed: %@", [error localizedDescription]);
        }
        else {
            NSLog(@"EndCallAction transaction request successful");
        }
    }];
}

答案 1 :(得分:0)

您必须将CXTransactionCXEndCallAction一起传递到requestTransaction

首先在initWithCallUUID中,您必须通过当前通话NSUUID。然后,您可以在requestTransaction上致电CXCallController并将[CXTransaction transactionWithActions:@[endaction]传递给nil,而不是CXEndCallAction *endaction = [[CXEndCallAction alloc] initWithCallUUID:[NSUUID UUID]]; // your current call UUID CXCallController *callController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()]; [callController requestTransaction:[CXTransaction transactionWithActions:@[endaction]] completion:completion];

location ~ \.php$ {
    include        /usr/local/etc/nginx/fastcgi_params;
    try_files      $uri =404;
    fastcgi_pass   unix:/var/run/php-fpm/php-fpm.socket;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param  SERVER_NAME $host;
    fastcgi_intercept_errors on;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 16k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_read_timeout 1200;
}