From dc383a7ee7531f5958f7b5d8747f90d782a4d052 Mon Sep 17 00:00:00 2001
From: James Golovich <james@gnuinter.net>
Date: Mon, 5 Apr 2004 18:03:40 +0000
Subject: [PATCH] Make outgoing call spool only consider # a comment if at the
 beginning of a line or following whitespace (bug 1346)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2625 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 pbx/pbx_spool.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

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';
-- 
GitLab