Save dialplan in new format
authorMark Spencer <markster@digium.com>
Fri, 30 May 2003 14:32:18 +0000 (14:32 +0000)
committerMark Spencer <markster@digium.com>
Fri, 30 May 2003 14:32:18 +0000 (14:32 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1065 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx/pbx_config.c

index bfec603..45953c6 100755 (executable)
@@ -995,13 +995,26 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
                                                        context_header_written = 1;
                                                }
 
-                                               if (ast_get_extension_priority(p)!=PRIORITY_HINT)
-                                                       fprintf(output, "exten => %s,%d,%s,%s\n",
+                                               if (ast_get_extension_priority(p)!=PRIORITY_HINT) {
+                                                       char *tempdata = NULL, *startdata;
+                                                       tempdata = strdup((char *)ast_get_extension_app_data(p));
+                                                       if (tempdata) {
+                                                               startdata = tempdata;
+                                                               while (*tempdata) {
+                                                                       if (*tempdata == '|')
+                                                                               *tempdata = ',';
+                                                                       tempdata++;
+                                                               }
+                                                               tempdata = startdata;
+                                                       }
+                                                       fprintf(output, "exten => %s,%d,%s(%s)\n",
                                                            ast_get_extension_name(p),
                                                            ast_get_extension_priority(p),
                                                            ast_get_extension_app(p),
-                                                           (char *)ast_get_extension_app_data(p));
-                                               else
+                                                           tempdata);
+                                                       if (tempdata)
+                                                               free(tempdata);
+                                               } else
                                                        fprintf(output, "exten => %s,hint,%s\n",
                                                            ast_get_extension_name(p),
                                                            ast_get_extension_app(p));