From f790adc6a1cd50efa68d72b399272ba5aeddefb7 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Mon, 17 Oct 2022 19:15:32 +0200 Subject: [PATCH 1/3] Make sure Gammu speaks english Gammu returns localized messages whereas GammuAdapter searches for string "nothing". Force Gammu to return english messages so word searches will work properly. This fixes #172 --- adapters/GammuAdapter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adapters/GammuAdapter.php b/adapters/GammuAdapter.php index fb32676..884da1f 100644 --- a/adapters/GammuAdapter.php +++ b/adapters/GammuAdapter.php @@ -188,6 +188,7 @@ namespace adapters; } $command_parts = [ + 'LC_ALL=C', 'gammu', '--config', escapeshellarg($this->data['config_file']), @@ -339,6 +340,7 @@ namespace adapters; } $command_parts = [ + 'LC_ALL=C', 'gammu', '--config', escapeshellarg($this->data['config_file']), @@ -351,6 +353,7 @@ namespace adapters; //Check security status $command_parts = [ + 'LC_ALL=C', 'gammu', '--config', escapeshellarg($this->data['config_file']), From 82021648a3d0a8d4ff21b6d73d7914e91945ca7f Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Mon, 17 Oct 2022 19:19:28 +0200 Subject: [PATCH 2/3] Don't bother to check SIM security status on successful unlock --- adapters/GammuAdapter.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/adapters/GammuAdapter.php b/adapters/GammuAdapter.php index fb32676..7bc2de7 100644 --- a/adapters/GammuAdapter.php +++ b/adapters/GammuAdapter.php @@ -337,7 +337,9 @@ namespace adapters; { return true; } - + + // The command returns 123 on failed execution (even if SIM is already unlocked), and returns 0 if unlock was successful + // We can directly return true if command was succesful $command_parts = [ 'gammu', '--config', @@ -348,8 +350,13 @@ namespace adapters; ]; $result = $this->exec_command($command_parts); + if (0 === $result['return']) + { + return true; + } //Check security status + // The command returns 0 regardless of the SIM security state $command_parts = [ 'gammu', '--config', From 4776b147e5da0edd4e8d2821636a135c00f527eb Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Wed, 19 Oct 2022 00:46:29 +0200 Subject: [PATCH 3/3] Make sure Gammu always sends as UTF-8 format --- adapters/GammuAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/GammuAdapter.php b/adapters/GammuAdapter.php index 884da1f..e01990b 100644 --- a/adapters/GammuAdapter.php +++ b/adapters/GammuAdapter.php @@ -195,7 +195,7 @@ namespace adapters; 'sendsms', 'TEXT', escapeshellarg($destination), - '-text', + '-textutf8', escapeshellarg($text), '-validity', 'MAX',