Templates and ! characher

what does the ! character do at the end of a line ?? Does it invalidate the code ?? It looks like the code beneath template section is without the “!” character

Here is a sample from a sample section on endpoint templates:

;===============ENDPOINT TEMPLATES

[endpoint-basic](!)

type=endpoint

context=internal

disallow=all

allow=ulaw

[auth-userpass](!)

type=auth

auth_type=userpass

[aor-single-reg](!)

type=aor

max_contacts= 1

;===============EXTENSION 6001

[ 6001 ](endpoint-basic)

auth=auth6001

aors= 6001

[auth6001](auth-userpass)

password= 6001

username= 6001

[ 6001 ](aor-single-reg)

It is an ! in parentheses and it means that the section doesn’t result in the creation of an actual endpoint, just provides template parameters that can be referenced in subsequent definitions.

It would probably be better if you collected all your questions on interpreting pjsip.conf into one thread, although templates are not specific to that file.

For Example:

Configuring chan_pjsip
Take a minute to look over the pjsip.conf sample file if you haven’t already. Then backup your pjsip.conf file and create a new blank one.

Add the following configuration:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

;Templates for the necessary config sections

endpoint_internal
type=endpoint
context=from-internal
disallow=all
allow=ulaw

auth_userpass
type=auth
auth_type=userpass

aor_dynamic
type=aor
max_contacts=1

You didn’t mark this up as pre-formatted text, for the forum, so important information was misinterpreted as mark up.

However, I think I can safely say that it isn’t a complete valid configuration.

Apologies – I looked through more of the online docs and found the explanation that the ! character prevents the code from executing the code — (can you tell I have never used Asterisk before ? :slight_smile:

Defining a template-only section

section
label = value

The exclamation mark indicates to the config parser that this is a only
a template and should not itself be used by the Asterisk module for
configuration. The section can be inherited by other sections (see section
“Using templates” below) but is not used by itself.