Skip to navigation

Using FreePBX and taking advantage of SignalWire’s disruptive pricing on DIDs and voice minutes is almost too easy.

Create a SIP Credential

FreePBX registers with SignalWire using a SIP Credential, the username and password SIP devices use to connect to your Space. If you don’t have one yet, create a SIP Credential and assign a phone number to it so inbound calls reach FreePBX.

Adjust the SIP Credential for FreePBX

Open the SIP Credential in the SignalWire Dashboard and update two settings on its Configuration tab so it works well with FreePBX, then deploy:

  1. Set Encryption to Required.
  2. Under Codecs and Ciphers, select Custom Ciphers and clear AEAD_AES_256_GCM_8. Asterisk supports this cipher only when it is built against a libsrtp with AES-GCM support and with its AES GCM and AES 256 SRTP build options turned on. Both build options are off by default.
  3. Select Deploy to save the changes.

Below the URI field, the same tab shows the SIP Credential’s full SIP address, in the form username@YOURSPACE-123456abc.sip.signalwire.com, with a copy button. You need both parts of it when you configure the trunk. The Dashboard doesn’t display the password; use the one you set when you created the SIP Credential, or set a new one with Change Password and select Deploy.

Configure Asterisk

Add a SIP (PJSIP) trunk, and on the General tab enter the following:

Trunk Name: SignalWire (Can be anything you want)
Outbound CallerID: 1-469-FREEPBX (the DID you purchased)

Tab of an Edit Trunk page in the Asterisk interface. Hide CallerID is set to No. Outbound CallerID is set to the purchased DID, in this case 14693733729. CID options is set to Allow Any CID. Maximum Channels is blank. Asterisk Trunk Dial Options is set to System. Continue if Busy, Disable Trunk, and Monitor Trunk Failures are all set to No

Then, on the PJSIP Settings tab and the General sub-tab, enter the following:

Username: freepbx (the URI of your SIP Credential, the part of its SIP address before the @)
Secret: (the password you set on your SIP Credential)
SIP Server: YOURSPACE-123456abc.sip.signalwire.com (the domain of your SIP Credential’s SIP address, the part after the @)
SIP Server Port: 5060 (standard SIP port)
Context: from-signalwire (default is ‘from-pstn’, but you must change it)

the PJSIP Settings tab of the Edit Trunk page in Asterisk. User name is set to freepbx. Authentication is set to Outbound. Registration is set to Send. Language Code is set to Default. The SIP Server is set to the SIP Credential's domain. SIP Server Port is set to 5060. Context is set to 'from-signalwire'. Transport is set to '0.0.0.0-udp'

As the last step on this screen, on the PJSIP Settings tab and the Advanced sub-tab, the following three settings:

From Domain: YOURSPACE-123456abc.sip.signalwire.com (the domain of your SIP Credential’s SIP address)
From User: freepbx (the URI of your SIP Credential)
Media Encryption: SRTP via in-SDP (select from drop-down)

The Advanced tab of the Edit Trunk page in Asterisk. From Domain is set to the SIP Credential's domain. From User is set to freepbx, the SIP Credential's URI. Media Encryption is set to SRTP via in-SDP.

Now your trunk is all set up!

Setting up the Dial Plan

There is a small amount of dialplan script to add (which we will place in a context called “from-signalwire” - remember, we set this in the above steps), in order to extract the dialed number from the SIP Header, before passing the call to FreePBX for normal processing.

We do this by entering the following lines in a file called extensions_custom.conf (which may be empty) using the inbuilt config editor in the Admin menu:

extensions_custom.conf
[from-signalwire]
exten => s,1,Set(numb=${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)})
same => n,Goto(from-pstn,${numb:1},1)

The editor is at Admin > Config Edit > extensions_custom.conf:

The Configuration File Editor. The file 'extensions_custom.conf' is selected, and the provided code has been entered in the conf file.

Now just set up your inbound routing (the DID will be in the format 12223334444) and your outbound routing as normal.

That’s all there is to it! You should now be able to make outbound calls over your SignalWire SIP trunk and accept incoming calls to the number you purchased.