SIP Router Project
FS#56 - Cfg parsing error for alias/listen and custom global parameter
Attached to Project:
sip-router
Opened by Daniel-Constantin Mierla (miconda) - Monday, 29 March 2010, 09:50 GMT
Last edited by Andrei Pelinescu-Onciul (andrei) - Tuesday, 07 September 2010, 19:21 GMT
Opened by Daniel-Constantin Mierla (miconda) - Monday, 29 March 2010, 09:50 GMT
Last edited by Andrei Pelinescu-Onciul (andrei) - Tuesday, 07 September 2010, 19:21 GMT
|
DetailsFollowing sequence of config rises errors:
<code> alias="sip.mydomain.com" myvar.msg="one" desc "One" </code> 0(4069) : <core> [cfg.y:3382]: parse error in config file kamailio.cfg, line 104, column 10: syntax error 0(4069) : <core> [cfg.y:3382]: parse error in config file kamailio.cfg, line 104, column 10: unknown config variable 0(4069) : <core> [cfg.y:3379]: parse error in config file kamailio.cfg, line 104, column 11-15: ERROR: bad config file (3 errors) Line 104 is 'myvar...' Having another core parameter in between is ok, e.g.,: <code> alias="sip.mydomain.com" port=5060 myvar.msg="one" desc "One" </code> Seems alias/listen grammar eats up to myvar.msg, considering to be host definition. |
This task depends upon
It happens because of an ambiguity in the grammar with alias and listen followed by a config var.
Both alias and listen can have an unquoted host list as value. An unquoted host is a list of
IDs separated by '.'. Since EOL is not taken into account (it's considered normal whitespace), alias=foo.bar followed by myvar.msg="..." is interpreted as:
alias=foo.bar myvar.msg
="..." <- error
An workaround for this (besides not having config variables after alias or host) is to add ';' after alias.
E.g.:
alias="foo.bar";
myvar.msg="...."
I don't think it can be fixed without adding an incompatible config syntax change.
We could add a special prefix for config vars. (e.g cfgvar myvar.msg="..."), document it as the right way and add an "obsolete" warning for cfg. vars declared without this prefix.