baresip: не удается подключиться к серверу при регистрации
Я пытаюсь выучить baresip
за VoIP
звоня в iOS, я использовал taresip
и все работает нормально, теперь я двигаюсь дальше baresip
. ниже код для регистрации.
required init?(username: String, password: String, agent: inout OpaquePointer?) throws {
guard libre_init() == 0 else { throw SipError.libre }
// 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 { throw SipError.config }
guard baresip_init(conf_config()) == 0 else { print("baresip init error"); return }
// Initialize the SIP stack.
guard ua_init("SIP", 1, 1, 1) == 0 else { throw SipError.stack }
// Load modules.
guard conf_modules() == 0 else { throw SipError.modules }
//let addr = "sip:\(username)@6x.1x3.x3.xx4;auth_pass=\(password);transport=upd;answermode=manual;audio_codecs=PCMU/8000/1;audio_codecs=PCMA/8000/1"
let addr = "sip:\(username):\(password)@6x.1x3.x3.xx4;transport=udp;answermode=manual"
// Start user agent.
guard ua_alloc(&agent, addr) == 0 else { throw SipError.userAgent }
uag_event_register({ (userAgent, event, call, prm, arg) in
print(event)
if event.rawValue == 6 {
DispatchQueue.main.async {
if let handler = SipClient.incommingCallHandler {
handler(call)
}
}
}
if event.rawValue == 10 {
print("Call Closed")
DispatchQueue.main.async {
if let handler = SipClient.callEnded {
//re_cancel()
handler()
}
}
}
}, nil)
let registered = ua_isregistered(agent)
if registered == 0 {
print("USER \(username)@xxx.xx.xx REGISTERED!!!!!")
} else {
print("USER REGISTERATION FAILED!!!")
}
DispatchQueue.global(qos: .userInitiated).async {
re_main(nil)
}
}
2020-08-18 16:18:39.114364+0530 baredemo[3781:1593382] [si_destination_compare] send failed: Invalid argument
2020-08-18 16:18:39.114479+0530 baredemo[3781:1593382] [si_destination_compare] send failed: Undefined error: 0
2020-08-18 16:18:39.114528+0530 baredemo[3781:1593382] [si_destination_compare] send failed: Invalid argument
Local network address: IPv4=pdp_ip1|10.67.50.101 IPv6=pdp_ip1|2405:205:ca0b:271e:1cb5:ebc:4cda:476e
[31mdl: mod: ./stdio.so (dlopen(//stdio.so, 6): image not found)
[;m[31mmodule stdio.so: No such file or directory
[;maucodec: PCMU/8000/1
aucodec: PCMA/8000/1
[31mdl: mod: ./coreaudio.so (dlopen(//coreaudio.so, 6): image not found)
[;m[31mmodule coreaudio.so: No such file or directory
[;mvidsrc: avcapture
medianat: stun
medianat: turn
medianat: ice
medianat: ice-lite
[31muuid: fopen() \260\216W/uuid (No such file or directory)
[;m[31mdl: mod: ./uuid.so (dlopen(//uuid.so, 6): image not found)
[;m[31mmodule uuid.so: No such file or directory
[;maccount: creating accounts template \260\216W/accounts
[31mdl: mod: ./account.so (dlopen(//account.so, 6): image not found)
[;m[31mmodule account.so: No such file or directory
[;mcontact: creating contacts template \260\216W/contacts
[31mdl: mod: ./contact.so (dlopen(//contact.so, 6): image not found)
[;m[31mmodule contact.so: No such file or directory
[;mPopulated 2 audio codecs
Populated 0 audio filters
Populated 0 video codecs
Populated 0 video filters
USER 204@xxxxxs.xxxxxx.xxx REGISTERED!!!!!
No Video codec used.
call: connecting to 'sip:202@xx.xx3.x3.xx4'..
sip:202@xx.xxxx.x3.xxx: session closed: Operation timed out
Call event:
call_event(rawValue: 4)
call: terminate call '102cef6876199d23' with sip:202@xx.xxx.xx.xx4
ua_event(rawValue: 11)
но когда я распечатываю журнал let registered = ua_isregistered(agent)
он возвращает 0 и получает успех, но когда я вижу журнал сервера, ничего не получается.
Я думаю, это проблема [si_destination_compare] send failed: Invalid argument
Я много чего ищу, но не могу найти решения. может кто-нибудь мне помочь?
Заранее спасибо.