]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10918 #resolve
authorSeven Du <dujinfang@x-y-t.cn>
Tue, 23 Jan 2018 02:56:30 +0000 (10:56 +0800)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:48 +0000 (07:21 +0000)
src/switch_xml.c

index 1dc8166ecaf70bf812cd9110f737b0f19a74db7a..0dffbd4b8c8d6acf5410c9f5153f27f77d7de98a 100644 (file)
@@ -141,6 +141,24 @@ static void preprocess_exec_set(char *keyval)
        }
 }
 
+static void preprocess_env_set(char *keyval)
+{
+       char *key = keyval;
+       char *val = strchr(key, '=');
+
+       if (key && val) {
+               *val++ = '\0';
+
+               if (*val++ == '$') {
+                       char *data = getenv(val);
+
+                       if (data) {
+                               switch_core_set_variable(key, data);
+                       }
+               }
+       }
+}
+
 static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rlevel);
 
 typedef struct switch_xml_root *switch_xml_root_t;
@@ -1469,6 +1487,8 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
 
                        } else if (!strcasecmp(tcmd, "exec-set")) {
                                preprocess_exec_set(targ);
+                       } else if (!strcasecmp(tcmd, "env-set")) {
+                               preprocess_env_set(targ);
                        } else if (!strcasecmp(tcmd, "include")) {
                                preprocess_glob(cwd, targ, write_fd, rlevel + 1);
                        } else if (!strcasecmp(tcmd, "exec")) {