Clarification on attribute inheritance

I have read some fellow posters claiming that the attributes in the sip.conf file are inherited according to their physical location in the file.

Supposedly, the lower portions of the file inherit the attributes (such as “context=”) from the upper portions of the file.

Well, that is not quite right.

It really works like global variables in many programming languages.

The whole thing is like a 2-level tree rooted at the [general] section, with a bunch of children. The attributes are inherited from the parent (the [general] section) by the children. The children DO NOT inherit anything from their siblings.

And, finally, the location of the sections in the file is completely irrelevant. You may place the [general] section at the bottom of the file, and it still is the parent. In other words, the name “general” is special and reserved. If you want to verify all this, use the “sip show user” CLI statement and take a look at the “default context” column.

-Ramon

Let me add something to this posting:

The only attribute that seems to have sense being inside the [general] and in the other sections in the “context”.

You can place some attribute like “port=1234” in the non-general section.
Asterisk will not complain but it will not change the port port that section, either.

I guess it’s safe to say that the only inheritable attribute (in sip.conf) is the context.

-RFH