[asterisk-users] Setvar=var=val in sip.conf

Michael Collins mcollins at fcnetwork.com
Tue Jul 18 12:10:15 MST 2006


> There needs to be a *CLEAR* policy on when spaces are and are not
> stripped!
> This type of bug would be murder to track down!  Spaces are typically
> stripped from configuration files, and to have ONE variable type in
the
> config file behave differently is an *unbelievably* poor design.
> 
> Was this intentional, or just how it turned out to be?
> 
> -A.

It sounds to me like there was an early decision made not to force users
to explicitly single- or double-quote strings under various
circumstances.  Unfortunately that conflicts with what is probably
viewed as "proper" handling of whitespace characters in config files.  

I have to agree with Andrew that a lack of consistency on the part of
the config file parser is not a good idea.  I think most programmers are
trained to delimit strings, whether containing whitespace characters or
not.  Most programmers are also trained to use backslashes or some other
means to put special characters into strings, e.g. saying something
like:
Myvar = "\""
-or-
Myvar = char(34)
-or-
Myvar = \x22

Would all produce the same thing, a one-character string: "

The real work, of course, is deciding how to fix it, assuming the
development community considers it "broken."  Can it be fixed without
breaking existing dial plans?  Possibly.  It might be necessary to add
the equivalent of a preprocessor directive in the config file, something
that tells the config parser, "Hey, strip all whitespace immediately
before and after the = sign."  Maybe something like this in
extensions.conf:

[general]
dropwhitespace=yes     ; default=no, when set to yes requires delimited
(quoted) strings



Obviously this would be a fair amount of work to implement, but in the
long run it probably is the right thing to do.  Easy for me to say when
I don't have the skills to actually do it, though. :)

Any other thoughts from those maintaining dialplans?  How big an issue
is this, really?  Will it get bigger as the Asterisk community grows
larger?

-MC



More information about the asterisk-users mailing list