diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index 946f369c358519e2ed674f884f1b2dbb322b2504..1dbee19db9602270701f36f43e9e153d16893ff3 100755 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -97,9 +97,13 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f) lineno++; if (!feof(f)) { /* Trim comments */ - c = strchr(buf, '#'); - if (c) - *c = '\0'; + c = buf; + while ((c = strchr(c, '#'))) { + if ((c == buf) || (*(c-1) == ' ') || (*(c-1) == '\t')) + *c = '\0'; + else + c++; + } c = strchr(buf, ';'); if (c) *c = '\0';