如何在使用 pjsip 来电时唤醒 iOS 应用程序

How to wake iOS apps when incoming calls comes using pjsip

我正在 iOS 开发 pjsip 音频呼叫软电话应用程序。我希望我的应用程序在任何来电时打开。

我试过在星号上找到 AGI。现在注册 pushtry pjsip 上没有文档 下一步是什么

// Register for VoIP notifications
- (void) voipRegistration {
    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    // Create a push registry object
    PKPushRegistry * voipRegistry = [[PKPushRegistry alloc] initWithQueue: mainQueue];
    // Set the registry's delegate to self
    voipRegistry.delegate = self;
    // Set the push type to VoIP
    voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
}

我们 API 使用 APNS 进行静默通知。它以正常流程唤醒应用程序。但是当 IVR 考虑到我的眼睛周围有烟雾时。

这个主题完全取决于星号的实现,我想了解的场景是当调解员试图连接星号中 IVR 系统上拨打的 DTMF 号码时,我如何实现发送推送通知的代码。谁能帮帮我?

您应该将 voipRegistry 存储为 属性,否则它将在方法结束时被释放。

您的委托人(符合 PKPushRegistryDelegate 的对象)将收到令牌。

您可以实现此委托方法来获取令牌并发送到服务器:

- (void)pushRegistry:(PKPushRegistry *)registry 
didUpdatePushCredentials:(PKPushCredentials *)pushCredentials 
             forType:(PKPushType)type {
    // get credentials.token
    // create registration using pjsip_regc_register()
}

在您的服务器上存储令牌。将它与 APNS 服务器 API 一起使用,以在有来电时激活您的应用程序。

然后您的应用将启动并调用委托方法:

- (void)pushRegistry:(PKPushRegistry *)registry 
didReceiveIncomingPushWithPayload:(PKPushPayload *)payload 
             forType:(PKPushType)type 
withCompletionHandler:(void (^)(void))completion {
    // handle payload
}