|
From: | Lindsey Vastola |
Subject: | [Linphone-users] Linphone sending register request multiple times on 3.16.5 |
Date: | Wed, 9 May 2018 09:37:29 -0400 |
private override init() {
super.init()
theLinphone.lct = LinphoneCoreVTable()
NSLog("Socket Host \(socketHost())")
socket.delegate = self
socket.voipEnabled = true
socket.disableSSLCertValidation = false
socket.disableSSLCertValidation = false
let configFilename = documentFile(file: "linphonerc222")
let factoryConfigFilename = bundleFile(file: "linphonerc-factory")
//
let configFilenamePtr: UnsafePointer<Int8> = configFilename.cString(using: String.Encoding.utf8.rawValue)!
let factoryConfigFilenamePtr: UnsafePointer<Int8> = factoryConfigFilename.cString(using: String.Encoding.utf8.rawValue)!
let factory = linphone_factory_get();
let cbs = linphone_factory_create_core_cbs(factory);
// Set Callback
theLinphone.lct?.registration_state_changed = registrationStateChanged
theLinphone.lct?.call_state_changed = callStateChanged
linphone_core_cbs_set_call_state_changed(cbs, callStateChanged)
linphone_core_cbs_set_registration_state_changed(cbs, registrationStateChanged)
theLinphone.lc = linphone_factory_create_core_with_config(factory, cbs, linphone_config_new_with_factory(configFilenamePtr, factoryConfigFilenamePtr))
linphone_core_cbs_ref(cbs)
linphone_core_reload_ms_plugins(theLinphone.lc, nil)
}
func receiveCall(){
guard (setIdentify()) != nil else {
print("no identity")
return;
}
}
func setIdentify() -> OpaquePointer! {
let identity = "sip:" + profile.did! + "@" + serverHost() + ":35060"
let proxy_cfg = linphone_core_create_proxy_config(theLinphone.lc)
let from = linphone_address_new(identity)
if (from == nil){
NSLog("\(identity) not a valid sip uri, must be like sip:address@hidden")
// return nil
}
linphone_core_set_user_agent(theLinphone.lc, "Agent:\(self.modelIdentifier()):\(longVersionNumber):\(self.getUniqueKey())", linphone_core_get_version()!)
let info=linphone_auth_info_new(number, nil,password, nil, nil, nil)
var transport = LinphoneSipTransports()
transport.tcp_port=35060
transport.udp_port=0
transport.tls_port=0
linphone_core_set_sip_transports(theLinphone.lc, &transport)
// configure proxy entries
linphone_proxy_config_set_identity_address(proxy_cfg, from)
linphone_proxy_config_set_server_addr(proxy_cfg, "\(identity)")
linphone_proxy_config_edit(proxy_cfg)
linphone_proxy_config_enable_publish(proxy_cfg, 1)
linphone_proxy_config_enable_register(proxy_cfg, 1)
linphone_proxy_config_done(proxy_cfg)
linphone_core_add_auth_info(theLinphone.lc, info)
linphone_core_add_proxy_config(theLinphone.lc, proxy_cfg)
linphone_core_set_default_proxy_config(theLinphone.lc, proxy_cfg)
linphone_proxy_config_unref(proxy_cfg)
linphone_address_unref(from)
linphone_auth_info_unref(info)
LinphoneManager.iterateTimer = Timer.scheduledTimer(
timeInterval: 0.02, target: self, selector: #selector(iterate), userInfo: nil, repeats: true)
return proxy_cfg
}
[Prev in Thread] | Current Thread | [Next in Thread] |