Stefan Schuermans commited on 2019-08-22 21:13:22
Showing 1 changed files, with 14 additions and 0 deletions.
... | ... |
@@ -418,6 +418,20 @@ void do_register(Data &data, std::string const &server, |
418 | 418 |
linphone_core_set_user_data(data.lc, &data); |
419 | 419 |
log(data, "linphone core created"); |
420 | 420 |
|
421 |
+ // set ports to random (to allow multiple SIP endpoints) |
|
422 |
+ LinphoneTransports *transports = linphone_factory_create_transports(factory); |
|
423 |
+ if (transports != nullptr) { |
|
424 |
+ linphone_transports_set_udp_port(transports, LC_SIP_TRANSPORT_RANDOM); |
|
425 |
+ linphone_transports_set_tcp_port(transports, LC_SIP_TRANSPORT_RANDOM); |
|
426 |
+ linphone_transports_set_tls_port(transports, LC_SIP_TRANSPORT_RANDOM); |
|
427 |
+ linphone_transports_set_dtls_port(transports, LC_SIP_TRANSPORT_RANDOM); |
|
428 |
+ linphone_core_set_transports(data.lc, transports); |
|
429 |
+ linphone_transports_unref(transports); |
|
430 |
+ log(data, "linphone core: transports set to random"); |
|
431 |
+ } else { |
|
432 |
+ log(data, "linphone core: cannot set transports"); |
|
433 |
+ } |
|
434 |
+ |
|
421 | 435 |
// set auth data |
422 | 436 |
if (! username.empty() && ! password.empty()) { |
423 | 437 |
LinphoneAuthInfo *auth_info = |
424 | 438 |