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 Daniel-Constantin Mierla (miconda) - Tuesday, 23 December 2014, 17:03 GMT
Task Type Bug Report
Category Core
Status Closed
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 100%
Votes 0
Private No


Following sequence of config rises errors:

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

myvar.msg="one" desc "One"

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

This task depends upon

Closed by  Daniel-Constantin Mierla (miconda)
Tuesday, 23 December 2014, 17:03 GMT
Reason for closing:  Won't implement
Additional comments about closing:  The workaround with ; after listen/alias (valid for any global parameter assignment) should be enough for the time being.
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), followed by myvar.msg=”...” is interpreted as: myvar.msg
=”...” ← error

An workaround for this (besides not having config variables after alias or host) is to add ‘;’ after alias.

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.