From 17e6e14b8f397149f43ac1a0b86fb543ec25bd77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Fri, 24 Feb 2023 11:09:35 -0500
Subject: [PATCH] sip: re-set interface to "default"

Before 1360c775e908741feaa9b7ebb926833f7e9d4c00 interface contains
"default", not an empty string. This cause the UDP transport to not
be-ing recycled and changing settings cause the SIP account to not
be re-registered correctly.
Also handle the case of empty interface, anyway it can be considered
as default.

GitLab: #826
Change-Id: I77068e44b7ea93463be2d8dec00b0da87a56370d
---
 src/sip/sipaccount.cpp      | 2 +-
 src/sip/sipaccount_config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sip/sipaccount.cpp b/src/sip/sipaccount.cpp
index b49d9cccd1..ed258282eb 100644
--- a/src/sip/sipaccount.cpp
+++ b/src/sip/sipaccount.cpp
@@ -1959,7 +1959,7 @@ SIPAccount::createBindingAddress()
     const auto& conf = config();
 
     IpAddr ret = conf.bindAddress.empty()
-                     ? (conf.interface == ip_utils::DEFAULT_INTERFACE
+                     ? (conf.interface == ip_utils::DEFAULT_INTERFACE || conf.interface.empty()
                             ? ip_utils::getAnyHostAddr(family)
                             : ip_utils::getInterfaceAddr(getLocalInterface(), family))
                      : IpAddr(conf.bindAddress, family);
diff --git a/src/sip/sipaccount_config.h b/src/sip/sipaccount_config.h
index 16f9944af3..e068ae2e33 100644
--- a/src/sip/sipaccount_config.h
+++ b/src/sip/sipaccount_config.h
@@ -45,7 +45,7 @@ struct SipAccountConfig : public SipAccountBaseConfig {
     /**
      * interface name on which this account is bound
      */
-    std::string interface;
+    std::string interface {ip_utils::DEFAULT_INTERFACE};
 
     /**
      * Determine if STUN public address resolution is required to register this account. In this
-- 
GitLab