我想通过使用SIP或linphone
库在iOS中调用应用程序。我搜索了很多但没有找到任何解决方案。在linphone
网站帮助我创建下面的代码,但在此代码中,我发现了一个错误。这个代码是否有效。我不知道是什么
while!linphone_proxy_config_is_registered( - proxy_cfg //如何在linphone中获取此功能)&&我< 40 。
当应用程序在后台或在iOS swift中使用linphone库终止时,如何显示来电屏幕。
func applicationDidEnterBackground(_ application: UIApplication)
{
linphone_core_refresh_registers(theLinphone.lc)
//wait for registration answer
var i: Int = 0
while !linphone_proxy_config_is_registered(proxy_cfg) && i < 40 {
i += 1
linphone_core_iterate(theLinphone.lc)
usleep(100000)
}
i += 1
//register keepalive handler
UIApplication.shared.setKeepAliveTimeout(600, handler: {() -> Void in
//refresh sip registration
linphone_core_refresh_registers(theLinphone.lc)
//make sure sip REGISTER is sent
linphone_core_iterate(theLinphone.lc)
})
if application.applicationState != .active {
var notif = UILocalNotification()
notif.repeatInterval = NSCalendar.Unit(rawValue: 0)
notif.alertBody = "New incoming call"
notif.alertAction = "Answer"
notif.soundName = "oldphone-mono-30s.caf"
UIApplication.shared.presentLocalNotificationNow(notif)
}
}