Securing Calls with TLS and SRTP
Endpoints can connect to FreePBX with encrypted connections. This requires configuration on both the FreePBX server and endpoint. These instructions assume that the server already has a valid certificate. If not, set up the server with a LetsEncrypt cert in Admin > Certificate Management.
Go to Settings > Asterisk SIP Settings.
Click on the SIP Settings [chan_pjsip] tab.
In the Misc PJSip Settings section, set Show Advanced Settings to Yes. Click Submit and Apply if the following sections do not show.
In the TLS/SSL/SRTP Settings section, select the appropriate certificate in the Certificate Manager dropdown menu. Select tlsv1_2 as the SSL Method. Set Verify Client to No and Verify Server to Yes.
In the Transports section, set tls - 0.0.0.0 - All to Yes.
In the 0.0.0.0 (tls) section, verify that the Port to Listen On is set to 5061.
Click on the General SIP Settings tab.
In the Security Settings section, set both Allow Anonymous Inbound SIP Calls and Allow SIP Guests to No.
Set the Default TLS Port Assignment to PJSIP. If the PJSIP option is greyed out, try restarting Asterisk to ensure that the TLS settings from the previous section are loaded.
Log into the server CLI
Run fwconsole stop to stop asterisk
Run fwconsole start to start asterisk
Modify each extension that requires TLS support. Click on the Advanced tab when editing an extension.
Set Transport to Auto or 0.0.0.0-tls.
Set Media Encryption to SRTP via in-SDP (recommended).
Set Allow Non-Encrypted Media (Opportunisitic SRTP) to No.
Set Direct Media to No.
Verify that DTLS is disabled.
Set up the account with the usual SIP settings, but include these specific settings:
Set SIP Transport to TLS.
Set Local SIP Port to 5061.
In Account > Advanced, set SRTP Mode or Media Encryption to SRTP Enabled and Required.
For Yealink T46S phones, copy the file certificate.pem from /etc/asterisk/keys/integration and install it:
Go to Security > Server Certificates.
In the Module dropdown list, select SIP, then choose Custom1 Certificates in the Device Certificates dropdown box.
In the Import Server Certificates section, change Import to to Custom1. Then browse for the certificate.pem file and upload it. Finally, click Confirm.
Go to Security > Trusted Certificates.
In the Module dropdown list, select SIP, then change Only Accept Trusted Certificates to Disabled.