linphone-daemon patch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

linphone-daemon patch

Mike Flood
Was using linphone-daemon on linux.

When I ran the command: "config-set sound playback_dev_id ALSA: Intel HDA"

It would set playback_dev_id to "ALSA:"

The below patch fixed the issue:

diff --git a/daemon/commands/config.cc b/daemon/commands/config.cc
index 7a59bff..c4ed008 100644
--- a/daemon/commands/config.cc
+++ b/daemon/commands/config.cc
@@ -18,6 +18,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */
 
 #include "configcommand.h"
+#include <regex>
 
 using namespace std;
 
@@ -72,7 +73,9 @@ void ConfigSetCommand::exec(Daemon *app, const string& args) {
         app->sendResponse(Response("Missing section and/or key names."));
         return;
     }
-    ist>>value;
+    getline(ist, value);
+    value = std::regex_replace(value, std::regex("^ +"), "");
+    value = std::regex_replace(value, std::regex(" +$"), "");
     lp_config_set_string(linphone_core_get_config(app->getCore()), section.c_str(), key.c_str(), value.size()>0 ? value.c_str() : NULL);
     app->sendResponse(ConfigResponse(value.c_str()));
 }


_______________________________________________
Linphone-developers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/linphone-developers
Reply | Threaded
Open this post in threaded view
|

Re: linphone-daemon patch

Nick Briggs
Why would you not have done

config-set sound playback_dev_id "ALSA: Intel HDA"

since the value had spaces in it...?

On May 5, 2020, at 8:03 PM, Mike Flood <[hidden email]> wrote:

Was using linphone-daemon on linux.

When I ran the command: "config-set sound playback_dev_id ALSA: Intel HDA"

It would set playback_dev_id to "ALSA:"

The below patch fixed the issue:

diff --git a/daemon/commands/config.cc b/daemon/commands/config.cc
index 7a59bff..c4ed008 100644
--- a/daemon/commands/config.cc
+++ b/daemon/commands/config.cc
@@ -18,6 +18,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */
 
 #include "configcommand.h"
+#include <regex>
 
 using namespace std;
 
@@ -72,7 +73,9 @@ void ConfigSetCommand::exec(Daemon *app, const string& args) {
         app->sendResponse(Response("Missing section and/or key names."));
         return;
     }
-    ist>>value;
+    getline(ist, value);
+    value = std::regex_replace(value, std::regex("^ +"), "");
+    value = std::regex_replace(value, std::regex(" +$"), "");
     lp_config_set_string(linphone_core_get_config(app->getCore()), section.c_str(), key.c_str(), value.size()>0 ? value.c_str() : NULL);
     app->sendResponse(ConfigResponse(value.c_str()));
 }

_______________________________________________
Linphone-developers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/linphone-developers


_______________________________________________
Linphone-developers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/linphone-developers
Reply | Threaded
Open this post in threaded view
|

Re: linphone-daemon patch

Mike Flood
Tried that,

The result was:

playback_dev_id being set to "ALSA:

I even tried escaping the space with \ still no luck.


From: "Nick Briggs" <[hidden email]>
To: "Mike Flood" <[hidden email]>
Cc: "linphone-developers" <[hidden email]>
Sent: Wednesday, May 6, 2020 12:39:10 AM
Subject: Re: [Linphone-developers] linphone-daemon patch

Why would you not have done

config-set sound playback_dev_id "ALSA: Intel HDA"

since the value had spaces in it...?

On May 5, 2020, at 8:03 PM, Mike Flood <[hidden email]> wrote:

Was using linphone-daemon on linux.

When I ran the command: "config-set sound playback_dev_id ALSA: Intel HDA"

It would set playback_dev_id to "ALSA:"

The below patch fixed the issue:

diff --git a/daemon/commands/config.cc b/daemon/commands/config.cc
index 7a59bff..c4ed008 100644
--- a/daemon/commands/config.cc
+++ b/daemon/commands/config.cc
@@ -18,6 +18,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */
 
 #include "configcommand.h"
+#include <regex>
 
 using namespace std;
 
@@ -72,7 +73,9 @@ void ConfigSetCommand::exec(Daemon *app, const string& args) {
         app->sendResponse(Response("Missing section and/or key names."));
         return;
     }
-    ist>>value;
+    getline(ist, value);
+    value = std::regex_replace(value, std::regex("^ +"), "");
+    value = std::regex_replace(value, std::regex(" +$"), "");
     lp_config_set_string(linphone_core_get_config(app->getCore()), section.c_str(), key.c_str(), value.size()>0 ? value.c_str() : NULL);
     app->sendResponse(ConfigResponse(value.c_str()));
 }

_______________________________________________
Linphone-developers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/linphone-developers



_______________________________________________
Linphone-developers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/linphone-developers