How do I connect my Allstar to FreePBX using a IAX2 or SIP Trunk?

How do I connect my Allstar to FreePBX using a IAX2 or SIP Trunk?

Are you looking to use FreePBX to access your nodes in AllStar or are you looking to allow your AllStar nodes to call extensions in FreePBX?

If it is for the former (FreePBX>AllStar), I can give you an example of how I setup an IAX trunk. My node numbers are just extensions in FreePBX that can be dialed.

I have not implemented the latter to allow AllStar access to FreePBX extensions.

I want to be able to dial into the node from freePBX

You will need to add a “Trunk” and “Outbound Routes” to FreePBX and new context sections to iax.conf and extensions.conf on your AllStar machine.

(1) FreePBX Trunk Setup
In FreePBX, go to “Connectivity”, then “Trunks” and select “Add Trunk > Add IAX2 Trunk”.

  • Give your trunk a name.
  • Leave all other settings on the “General” tab at defaults.
  • Leave all settings on the tab “Dialed Number Manipulation Rules” at defaults.
  • On the tab “iax Settings” and sub-tab “Outgoing” and give your outgoing trunk context a name e.g. pbxtrunk (leave the sub-tab “Incoming” at default).
  • Under “PEER Details”, add the info below setting your own host name or ip and a password.
    Note that this will match the context that you will later add to AllStar in iax.conf.
host=10.0.1.10
type=friend
context=iax-trunk
username=pbxtrunk
auth=md5
secret=SuperSecretPassword
disallow=all
allow=ulaw
  • Select “Submit” at the bottom of the page to save your new trunk settings.

(2) FreePBX Outbound Route Setup
In FreePBX, go to “Connectivity”, then “Outbound Routes”, then “Add Outbound Route”.

  • On the “Route Settings” tab, leave all settings at default EXCEPT “Trunk Sequence for Matched Routes”.

  • Select your trunk route created in the first step in the drop-down for “Trunk Sequence for Matched Routes”.

  • On the tab “Dial Patterns”, you will add an entry for each node number you want accessible on your AllStar server.

  • Enter your node number in the box titled “match pattern” and then click the “+” sign at the far right to add the entry.

  • Enter any additional nodes that are located on the same server.

  • Leave all setting on the tabs “Import/Export Patterns”, “Notifications” and “Additional Settings” at defaults.

  • Select “Submit” at the bottom of the page to save your new trunk settings.

  • Select the red “Apply Config” option at the top of the FreePBX screen.

(3) AllStar iax.conf Setup

  • On your AllStar node, open the iax.conf file for editing.
  • Scroll down past the existing contexts and add a new context (text below) that matches your FreePBX trunk.
    This is the authorization portion of the link from FreePBX to AllStar.
[pbxtrunk]   		                ; Connect from iax PBX trunk on FreePBX
type = friend                     	; Notice type here is friend <--------------
context = iax-trunk
username=pbxtrunk
auth = md5
secret = SuperSecretPassword
host = dynamic
disallow = all
allow = ulaw
allow = adpcm
allow = gsm
transfer = no
  • Save the file and exit the editor.

(4) AllStar extensions.conf Setup

  • On your AllStar node, open the extensions.conf file for editing.
  • Scroll down past the existing contexts and add a new context (text below) that matches your FreePBX trunk context name, e.g. iax-trunk.
    This is the connection/call handling portion of the link from FreePBX to AllStar. Note that I have commented out the lines for Playback & SayDigits for the connection messages. I have this configured to just say “Connected” on successful connection. You can change this is you wish to hear the complete connection message.
; for IAX FreePBX trunk calls.
[iax-trunk]
exten => _XXXXX!,1,Ringing()
	same => n,Wait(1)
	same => n,Answer()
	same => n,Set(CALLSIGN=${CALLERID(name)})
	same => n,NoOp(Caller ID name is ${CALLSIGN})
	same => n,NoOp(Caller ID number is ${CALLERID(number)})
	same => n,GotoIf(${ISNULL(${CALLSIGN})}?hangit)
	same => n,Playback(rpt/connected)
;	same => n,Playback(rpt/connected-to&rpt/node)
;	same => n,SayDigits(${NODE})
	same => n,rpt(${EXTEN}|P|${CALLSIGN})
	same => n(hangit),NoOp(No Caller ID Name)
	same => n,Playback(connection-failed)
	same => n,Wait(1)
	same => n,Hangup
  • Save the file and exit the editor.

  • Restart AllStar/Asterisk to apply changes.

You should now be able to dial the extensions (nodes) added in step 2 from your PBX phones.

Hey, thank you, It works.

Do you know how to set it up so when you dial into the node you can do *99 to TX and # to stop transmitting

That should be working by default. That’s what I use on my nodes from the phones.