I am creating an application for free audio and video calling using baresip, I have created demo and its working fine in Swift 4.2 , Now same thing I am applying in my existing project and its give me strange behaviour, existing project is in Swift 3.0, below is my code.
` override func viewDidLoad() {
super.viewDidLoad()
guard libre_init() == 0 else { return }
// Initialize dynamic modules
mod_init()
// make configure file
if let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first {
conf_path_set(path)
}
guard conf_configure() == 0 else { return }
guard baresip_init(conf_config(), 0) == 0 else { return }
//Initialize the SIP Account
guard ua_init("SIP",1,1,1,0) == 0 else { return }
// Load Modules
guard conf_modules() == 0 else { return }
let addr = "sip:101@ssss.com;auth_pass=IB5zbrzi;transport=upd;answermode=manual;audio_codecs=PCMU/8000/1;audio_codecs=PCMA/8000/1"
// Start user agent.
guard ua_alloc(&agent, addr) == 0 else { return }
let registered = ua_isregistered(agent)
if registered == 0 {
print("USER 101@magnates.siptpna.com REGISTERED!!!!!")
} else {
print("USER REGISTERATION FAILED!!!")
}
uag_event_register({ (agent, event, call, param, arg) in
print("User Agent \(event)")
}, nil)
call_set_handlers(ua_call(agent), { (call, call_event, str, arg) in
print("Call event: ")
print(call_event)
if call_event.rawValue == 0 {
print("Incomming call from \(str): \(arg)")
}
if call_event.rawValue == 4 {
// re_cancel()
ua_hangup(call_get_ua(call), call, 0, "Call Disconnected By peer")
}
}, { (call, key, arg) in
// print(call)
// print(key)
// print(arg)
}, nil)
// Start the main loop.
DispatchQueue.global(qos: .userInitiated).async {
re_main(nil)
}
}`
`///////Out put in NSLog
Printing description of path: "/var/mobile/Containers/Data/Application/904E1C0B-EEC4. -4642-B61A-079A9FBC5D92/Documents"
config: creating config template UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUA\247cء!/config
[31mconfig: writing UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUA\247cء!/config: No such file or directory`
I am creating an application for free audio and video calling using baresip, I have created demo and its working fine in Swift 4.2 , Now same thing I am applying in my existing project and its give me strange behaviour, existing project is in Swift 3.0, below is my code.