Asterisk explanation of sip parameters

Hi everyone,

I am not expert in asterisk but know few things in asterisk. I want to learn more about the asterisk. On my device, I am using asterisk 13 and operating system OpenWRT(Linux distro).

After googling and researching, I was able to configure my sip configuration but was not able to understand all of them or find related documents.

My sip configuration:

[phone]
host=q123.sip.us1.twilio.com
secret=12345qwertyabcd
defaultuser=usr4
fromuser=usr4
fromdomain=q123.sip.us1.twilio.com
insecure=port,invite
type=peer
allow=gsm,ulaw,alaw
dtmfmod=rfc2833
qualify=yes
canreinvite=nonat
nat=yes
keepalive=45
trustrpid=yes
sendrpid=yes
context=incoming-context
alwaysauthreject=yes
srvlookup=yes
mailbox=1001@vm_setup
tos_sip=cs3
tos_audio=ef

Can somebody please explain me the parameters such as: insecure, qualify, canreinvite, nat, keepalive, trustrpid, sendrpid, alwaysauthreject, srvlookup?

Thanks.

Please do not use insecure without understanding it!

Insecure=invite causes Asterisk to accept incoming calls without authenticating the caller. This was often necessary before the introduction of remotesecret, as ITSPs expect you to authenticate yourself, but don’t authenticate themselves to you.

insecure=port allow calls from the “wrong” port number, and should only be used if really required (e.g. TCP)

I’m not convinced that canreinvite=nonat means anything, as canreinvite was replaced by dierctmedia, I think, before nonat was added.

nat = yes is deprecated. It is roughly equivalent to nat=force_rport, comedia, and causes Asterisk to behave as though the rport option had been used, and causes it to wait for incoming media, and then send outgoing media to the same address., rather than the one in the SDP.

tos_* probably do nothing as ISPs don’t honour them.

dtmfmod should do nothing as it is mis-spelled.

Generally, the explanation are in sip.conf.sample

2 Likes

PS type=peer is good, as you will get authentication by IP address.

Thanks @david551 for your reply.

Your reply certainly eliminated my confusion.

Can you also explain following parameters if possible?
keepalive, trustrpid, sendrpid, alwaysauthreject, srvlookup

Thank you again.

Could you explain what is wrong with the descriptions in sip.conf.sample.

keepalive is too new for me, but is probably about ensuring there is always activity.

trustrpid means use the Remote-Party-ID or P-Asserted-Identity headers, if present, to get caller ID and receive connected party updates.

sendrpid causes Asterisk to send Remote-Party-Id, or P-Asserted-Identity, as selected by the option, and enables the sending of Re-INVITEs when the connected party changes.

alwaysauthreject causes Asterisk to behave in a way in which an attacker finds it difficult to know what they got wrong. I think it means send 401, even though you already know that the attacker is bogus, but I’m not sure.

svrlookup has something to do with DNS SVR records, but I’ve never used those.

These are off the top of my head. sip.conf.samples may give better explanations.

Hi @david551 ,

Thanks for your reply.

If I remove “insecure=invite”, incoming is not working, so I thought I am doing something wrong with those properties. But, if I add"insecure=invite" it works fine.

As I said, ITSP’s don’t authenticate themselves.

However, in my view, replacing secret by remotesecret is a clearer way of doing the same thing; it just wasn’t available when most cookbooks were written.

Does that mean that the server does not send a 401 unauthorized to the party that sends the first invite?

It means it does not send 401 in response to an INVITE from the party that has that insecure option in their sip.conf entry, even though they do have a secret, or md5secret, in that same entry.

1 Like

And what is the difference between remotesecret and Insecure=invite?

remotesecret is a newer option that causes Asterisk to use the value only for outgoing authentication. It may be combined with secret to have different secrets in each direction. insecure=invite is an older option that disables authentication in the inbount direction, only for INVITEs, not REGISTERs.

3 Likes

And what exactly falls under outgoing authentication?
Asterisk registering to a voice service provider as well as sending a modified invite after being challenged to authenticate by a 401 unauthorized?

As I understand it, the insecure=invite is there to prevent your server to challenge the ITSPs with a 401.
Does remotesecret have the same effect, cause I see it’s recommended as an alternative?

What is the benefit of being able to use different secrets in each direction with remotesecret?

Asterisk responding to a 401 (or 407) response from the peer.

So if I am using remotesecret instead of secret, my server won’t challenge an incoming Invite for authentication with a 401 or 407?

If you use remotesecret, and not secret it will not challenge for authentication on any transaction, including REGISTER. That is typically the right thing for ITSPs.

1 Like

So the difference between insecure=invite and remotesecret would then be that remotesecret will not challenge on any transaction, whereas insecure=invite will not challenge only on Invites (but would challenge on Register e.g.).

Correct?

Probably, but the real reason is that remotesecret is a new feature. In practice, insecure=invite is only used with host=dynamic, so inbound REGISTER would never happen.