Summary:ASTERISK-09712: Request alternate column name "call-limit" to "call_limit" for SIP realtime configuration.
Reporter:Nattapong Mongkolnavin (iamoat)Labels:
Date Opened:2007-06-20 02:06:33Date Closed:2007-06-22 17:05:45
Versions:Frequency of
Environment:Attachments:( 0) chan_sip.c.diff
Description:Some database application doesn't like having a "-" in the column name when dealing with Realtime configuration. So I would like to request asterisk to support additional column name for "call_limit" in realtime configuration.


Attached file is a diff from chan_sip.c of asterisk 1.4.4
Comments:By: Jason Parker (jparker) 2007-06-21 15:50:53

Is this just a perceived problem, or an actual problem you're seeing?  Databases should be just fine with the dash character, you may just have to quote the column when creating the tables.  Some databases would use [column-name] and others `column-name`.

By: Nattapong Mongkolnavin (iamoat) 2007-06-21 21:40:38

This is not an actual problem but we are using a php object relational mapping tool (propel) to generate php scripts for interacting with the asterisk realtime database and it has a problem with column names with a '-' included.

I believe other people might have the same problem when using other ORM tools.

The way we fixed the problem  was to change chan_sip.c source code to accept an alternate name for 'call_limit' since version 1.2.x and recompile the code.

In addition, chan_sip.c uses a variable name 'call_limit' to store the value of 'call-limit' itself. So I think for a consistency we might just use the name 'call_limit' in the configuration file as well.

The code I submitted is a backward compatible since it accepts both 'call-limit' and 'call_limit'.

Please note that for any future configuration parameters in any configuration files I would suggest naming rule to be consistent and contain only [a-z][A-Z][0-9][_].


By: Jason Parker (jparker) 2007-06-22 17:05:45

I would recommend reporting a bug to the propel folks, since as a script that deals with databases, it must be able to support column names such as those.  You're most certainly going to run across this in other places besides asterisk.

According to a SQL-99 validator I used, a dash in a column name is valid SQL-99 (though, apparently it is not valid SQL-92 - but that was 15 years ago, so nobody cares).

As such, I'm going to close this issue, unless you can show me a database that this won't work with.