]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_config_pgsql: Fix regression that removed dbname config.
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 11 Feb 2025 18:35:14 +0000 (11:35 -0700)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 20 Mar 2025 18:29:21 +0000 (18:29 +0000)
A recent commit accidentally removed the code that sets dbname.
This commit adds it back in.

Resolves: #1119
(cherry picked from commit 89764215049dc2f8e883b43e70043573fcbe6ed2)

res/res_config_pgsql.c

index cb57ee9f4029046cc0242bb1758b0726e16c3d36..1a2fc224b80e9d8602556d1266819b736e83d52e 100644 (file)
@@ -1495,6 +1495,14 @@ static int parse_config(int is_reload)
                ast_copy_string(dbhost, s, sizeof(dbhost));
        }
 
+       if (!(s = ast_variable_retrieve(config, "general", "dbname"))) {
+               ast_log(LOG_WARNING,
+                       "PostgreSQL RealTime: No database name found, using 'asterisk' as default.\n");
+               strcpy(dbname, "asterisk");
+       } else {
+               ast_copy_string(dbname, s, sizeof(dbname));
+       }
+
        /* Check new 'port' option first, then fall back to legacy 'dbport' */
        s = ast_variable_retrieve(config, "general", "port");
        if (!s) {