Index: pbx/pbx_spool.c =================================================================== --- pbx/pbx_spool.c (revision 116768) +++ pbx/pbx_spool.c (working copy) @@ -128,8 +128,12 @@ char buf[256]; char *c, *c2; int lineno = 0; - struct ast_variable *var; + struct ast_variable *var, *last = o->vars; + while (last && last->next) { + last = last->next; + } + while(fgets(buf, sizeof(buf), f)) { lineno++; /* Trim comments */ @@ -222,8 +226,13 @@ if (c2) { var = ast_variable_new(c, c2); if (var) { - var->next = o->vars; - o->vars = var; + /* Always insert at the end, because some people want to treat the spool file as a script */ + if (last) { + last->next = var; + } else { + o->vars = var; + } + last = var; } } else ast_log(LOG_WARNING, "Malformed \"%s\" argument. Should be \"%s: variable=value\"\n", buf, buf);