I've tried the taresip cocoa pod and it worked in the simulator but since it didn't work on a real device (arm64) I followed the guide here to compile the libraries myself but I think I might not have added them right to my project, now the code runs on the simulator but it writes this to the console right after starting.
[31mua: no network
[;merror: stack
update: solved the no network error by adding
guard baresip_init(conf_config(), 0) == 0 else { print("baresip init error"); return }
to my code but now on the simulator it successfully establishes the call but I hear no audio, but when I run the same code on a real iPhone X it gives me a proxy error
code below:
`
Import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
var agent: OpaquePointer? = nil
var client: SipClient? = nil
do {
client = try SipClient(agent: &agent)
} catch {
print("error: \(error) FDX")
}
}
enum SipError: Error {
case libre
case config
case stack
case modules
case userAgent
case call
}
final class SipClient {
required init?(agent: inout OpaquePointer?) throws {
guard libre_init() == 0 else { throw SipError.libre }
// Initialize dynamic modules.
mod_init()
print("after mod init")
// Make configure file.
if let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first {
conf_path_set(path)
}
guard conf_configure() == 0 else { throw SipError.config}
guard baresip_init(conf_config(), 0) == 0 else { print("baresip init error"); return }
// Initialize the SIP stack.
guard ua_init("baresip v" + BARESIP_VERSION + " (" + ARCH + "/" + OS + ")", 1, 1, 1, 0) == 0 else { throw SipError.stack }
// Load modules.
guard conf_modules() == 0 else { throw SipError.modules }
let addr = "sip:101@192.168.20.204:5060;transport=udp;answermode=auto;auth_pass=101;"
// Start user agent.
guard ua_alloc(&agent, addr) == 0 else { throw SipError.userAgent }
// Make an outgoing call.
guard ua_connect(agent, nil, nil, "sip:201@192.168.20.204:5060", VIDMODE_OFF) == 0 else { throw SipError.call }
// Start the main loop.
re_main(nil)
}
func close(agent: OpaquePointer) {
mem_deref(UnsafeMutablePointer(agent))
ua_close()
mod_close()
// Close and check for memory leaks.
libre_close()
tmr_debug()
mem_debug()
}
}
I've tried the taresip cocoa pod and it worked in the simulator but since it didn't work on a real device (arm64) I followed the guide here to compile the libraries myself but I think I might not have added them right to my project, now the code runs on the simulator but it writes this to the console right after starting.
update: solved the no network error by adding
guard baresip_init(conf_config(), 0) == 0 else { print("baresip init error"); return }
to my code but now on the simulator it successfully establishes the call but I hear no audio, but when I run the same code on a real iPhone X it gives me a proxy errorcode below: ` Import UIKit
class ViewController: UIViewController {
} `