sip-router

SIP Router Project

Tasklist

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
Task Type Bug Report
Category Core
Status Assigned
Assigned To Andrei Pelinescu-Onciul (andrei)
Operating System All
Severity Very Low
Priority Low
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Following sequence of config rises errors:

alias="sip.mydomain.com"
myvar.msg="one" desc "One"

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.,:

alias="sip.mydomain.com"
port=5060
myvar.msg="one" desc "One"

Seems alias/listen grammar eats up to myvar.msg, considering to be host definition.

This task depends upon

Comment by IƱaki Baz Castillo (ibc) - Monday, 29 March 2010, 12:02 GMT

Doesn't the grammar parser split the parameter declarations into lines?

Comment by Andrei Pelinescu-Onciul (andrei) - Tuesday, 07 September 2010, 19:21 GMT
  • Field changed: Severity (Medium → Very Low)
  • Field changed: Priority (Normal → Low)

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.

Loading...