Multiple templates defined for max_contacts

Hi everyone,

I couldn’t find information on this topic online, so I’m hoping to get some insights here regarding the pjsip.conf in Asterisk.

Here’s the scenario:

[234100](aor-tpl, aor-tpl02)
type=aor
qualify_frequency=60
qualify_timeout=8

[aor-tpl](!)
max_contacts=33

[aor-tpl02](!)
max_contacts=20

In this configuration, which max_contacts setting will be applied to [234100]? Also, will this setup cause any errors?

Thank you for your help!

I would expect aor-tpl02 to apply, but you could just try it and see what happens and experiment.

The docs site[1] also talks about what the resulting config looks like with the templates applied.

[1] Using Templates - Asterisk Documentation

Using an example from the provided link, it will be structured as follows:

[test-three]
permit=192.168.0.2
host=alpha.example.com
deny=192.168.0.1
permit=192.168.1.2
host=bravo.example.com
deny=192.168.1.1
permit=192.168.3.1
host=charlie.example.com

I assume that these last values will override the previous ones.

It depends on the parsing code, and the option. Most modules read options sequentially and look them up, and I think that applies to chan_pjsip, but others, did, or do, go through a list of possible options, and see if they exist in the configuration, which results in a first occurrence wins behaviour. At least that used to be the case.

Also some repeated options act incrementally, That’s true for codecs, but I think it is also true for permit and deny, in which case, I think the above results in all but the two addresses, in the deny lines, being permitted.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.