aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-21 18:40:14 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-21 18:40:14 +0000
commit741ba21e7eb7330dda284110d9dd069c1fff7b6e (patch)
tree4cee42c854ebc6fbcc2327890338654680a60599 /pbx
parentc6349aca4b981b49720cb66ddf968482daacf43d (diff)
Strip the preamble from the output also when -rx is not being used
(Related to issue #12702) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@117519 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_spool.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 8cf38a116..931697142 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -128,7 +128,11 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
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++;
@@ -222,8 +226,13 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
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);