diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index 946f369c35..1dbee19db9 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';