Setting Up a SIP Trunk in FreePBX

This guide provides step-by-step instructions on how to add a new SIP trunk in FreePBX.

Prerequisites

Make sure you have the following:

  • an installed and running FreePBX server

  • a SIP account from CommPeak
    The SIP credentials and domain details that you need are available in your account at CommPeak Portal in Setup > SIP Accounts:

  • User - click SHOW under Username/IP in a SIP account line

  • Password - click Reset Password if you forgot it

  • Domain - sip.commpeak.com

    Screenshot of SIP account data in CommPeak Portal

    SIP account data in CommPeak Portal

Adding a SIP Trunk

Step 1: Access FreePBX

Open a web browser and navigate to your FreePBX server's IP address or domain. Log in to the server with your admin credentials.

Screenshot of FreePBX login section

FreePBX login section

Step 2: Navigate to Trunk Management

Once logged in, go to the top menu and hover over Connectivity. In the drop-down menu, click Trunks.

Screenshot of Connectivity section in the FreePBX top menu

Connectivity section in the FreePBX top menu


Step 3: Add SIP Trunk

Click the Add Trunk button on the Trunks page, then select Add SIP (chan_pjsip) Trunk.

Screenshot of Add SIP Trunk option

Add SIP Trunk option

Step 4: General Settings

Enter the following data on the General tab:

  • Trunk Name: enter any name for the trunk, e.g., MyTrunk

  • Outbound CallerID: this is your Caller ID

  • Maximum Channels: this is the maximum number of simultaneous calls you can have; leave it blank for no limit.

    Screenshot of General tab of the trunk configuration

    General tab of the trunk configuration

Step 5: pjsip Settings

Enter the following data on the pjsip Settings tab:

  • Username: this is your SIP username

  • Secret: this is your SIP password

  • SIP Server: this is your SIP domain

  • Context: set this to from-internal, which ensures the trunk acts as if calls are originating from internal extensions

    Screenshot of Settings tab of the trunk configuration

    Settings tab of the trunk configuration

Step 6: Codecs

On the pjsip Settings tab, scroll down to Codecs and allow the ulaw _and _alaw codecs.

Screenshot of Setting codecs in the trunk configuration

Setting codecs in the trunk configuration

Click the Submit button at the bottom of the page to save your changes.

Step 7: Apply Changes

Click the Apply Config button at the top of the page to apply the changes.

Screenshot of Applying config changes

Applying config changes

Step 8: Configure Outbound Routes

To use this trunk for outbound calls, you must configure outbound routes.

  1. Go to Connectivity > Outbound Routes.

    Screenshot of Connectivity section in the trunk settings

    Connectivity section in the trunk settings

  2. Click Add Outbound Route.

    Screenshot of Adding an outbound route

    Adding an outbound route

  3. Provide a route name. In the Trunk Sequence section, select your new trunk.

    Screenshot of Outbound route settings

    Outbound route settings

  4. Add patterns for the numbers you want to route in the Dial Patterns section.

    Screenshot of Outbound route dial patterns

    Outbound route dial patterns

  5. Click the Submit button at the bottom of the page to save your changes. Then click Apply Config at the top-right again.

Step 9: Test the SIP Trunk

Finally, you can make a test call to verify that everything works correctly. You can do this from a registered SIP device (softphone or IP phone) configured to use your FreePBX server.

Troubleshooting

If you encounter any issues, go to Reports > Asterisk Logfiles in your FreePBX to view logs for troubleshooting.

Screenshot of Asterisk logfiles in Reports

Asterisk logfiles in Reports