FREEPBX Connection

Hi jmurraysolutions , I am in same situation , have some customers on same Freepbx .
for inbound call no problem , I do Direct IP .and have no problem .
For outbound call, I try like you said, but my call don’t go out ( with pjsip, outbound auth).
I re read what you say, and retry but still stuck.i see trunk registered , but call don’t get out
Only way for working with Freepbx for me, keep same pjsip trunk like this, and activate IP Auth in astpp.
For do difference between customer, I put prefixe on IP in ASTPP, and prepend on outbound route of customer on Freepbx .
Weird only sip auth not working for me , but working on any sip client without IP auth(astpp side) …

Here’s a more detailed guide with screenshots:

This guide assumes ASTPP is set up correctly with the following:

  • Provider Account
  • Gateway for the provider
  • Trunk with the gateway set.
  • Termination Rates for the trunk
  • Rate Group with the trunk selected
  • Origination Rates for the rate group
  1. In the customer account you want to bill the calls to from freepbx, create a SIP device.

Caller ID and Name can be left empty here unless you want to force all calls from these SIP credentials to have a fixed caller ID.

Status will need to be Active.
Voicemail Enable should be false here since you’ll likely want the Freepbx voicemail to deal with this.

  1. On Freepbx, create a Trunk.

CHAN PJSIP Settings will be as follows:

Trunk Name: As you wish, here we’ve just put ASTPP for demo purposes.
Hide CallerID: No
Outbound Caller ID: Blank
CID Options: Allow Any CID
Maximum Channels: If you have set max channels on the customer account on ASTPP, it would be a good idea to set this so FreePBX is aware not to attempt more calls if this value is reached.
Continue If Busy: This is for failover purposes which are outside the scope of this document.
Disable Trunk: No
Monitor Trunk Failures: Unless you know what to do with this, leave it to No.

Then go to the PJSIP settings tab:

Enter the Username as generated or created on the SIP Device you created in ASTPP.
The password from the SIP Device should be entered in the secret field.
Authentication: Outbound (We don’t want to authenticate inbound calls from ASTPP as this adds extra complications that are outside the scope of this document, there is no security risk here as we’ll be performing IP authentication on inbound).
Registration: Let’s keep it simple: None
Context: from-pstn

On the Codecs Tab, ensure alaw and ulaw are selected (these are the defaults in ASTPP where they are referred to as PCMA and PCMU).

Submit

CHAN SIP settings are as follows:

Trunk Name: As you wish, here we’ve just put ASTPP for demo purposes.
Hide CallerID: No
Outbound Caller ID: Blank
CID Options: Allow Any CID
Maximum Channels: If you have set max channels on the customer account on ASTPP, it would be a good idea to set this so FreePBX is aware not to attempt more calls if this value is reached.
Continue If Busy: This is for failover purposes which are outside the scope of this document.
Disable Trunk: No
Monitor Trunk Failures: Unless you know what to do with this, leave it to No.


SIP Settings:

Outgoing:
Trunk name: Whatever you like.
PEER Details:

host=[ASTPP HOSTNAME OR IP]
username=[ASTPP SIP DEVICE USERNAME]
secret=[ASTPP SIP DEVICE PASSWORD]
type=peer
context=from-ptsn
insecure=port,invite
nat=no
disallow=all
allow=alaw,ulaw

Incoming:

All fields on the incoming tab should be blank since we’ve already covered this on the outgoing settings tabs with the lines “insecure” to allow the invites in without challenging for authentication and “context” to send the calls that come in from ASTPP to the Inbound Routes module.

Submit

  1. Create your outbound route.
  2. Set up your extension(s) with their external caller ID
  3. Make some calls!

A very good explanation and use of connectivity. Thanks for sharing.

1 Like

Its really useful explanation and helpful to other members as well to configure such flow’s.

Thanks for sharing @jmurraysolutions

1 Like

@jmurraysolutions , thanks for all these details.
Is exactly what i setup on my freepbx for the astpp trunk.
But still not working outbound call … ( without ip auth)
TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 21
for info i use 4.0.1 on cent OS enterprise edition

Do a call with your setup and grab the output of the asterisk cli and freeswitch, ideally whilst no other traffic is occurring, post the logs (anonymizing the actual phone number by replacing the last few digits with X).

Please ensure you have enough of the phone number visible on the logs that match the longest prefix(es) on your astpp solution.

I recommend using pastebin for the logs to keep this forum page tidy, just post the link on your reply.

ok thanks ,
I put freeswitch log first because I thing it’s here I have problem of register .
5000 is sip device, Y.Y.Y.Y.fr is domain for this customer, and X.X.6.61 is my freepbx .
If I put this sip device in a soft phone outbound call work , but not from freepbx …
error register - FreeSWITCH Pastebin

If you look at the guide I posted above, there is no need to register from freepbx to astpp.

Authentication will be done on the invite when you attempt the call.

I know , i do exactly same sétup on freepbx that you post. But look freeswitch log, there is a register error …
And my call can’t pass thrue thé Free switch after …

Hi John,

I just looked over my instructions, and it appears I forgot one part of the CHAN SIP config.

Ensure registration is disabled and add

qualify=no

to your peer details and retry.

Ok, but i try for pjsip trunk, don’t have Sip quality option, only qualify frequency, i put to 0 but still not working.
I will retry in sip with sip qualify no …

I also try with sip and qualify=no, still same problem…

OK, with registration disabled and CHAN SIP entry with qualify=no, retry the call but grab both Asterisk and Freeswitch CLI logs and post them here so I can see what’s going on.

Ok i do and same problem .
Here asterisk log and freeswitch log
https://pastebin.freeswitch.org/view/7f474aef#iol8GqoidBii4LfTWWappptEClwZyVE7

Thanks

There’s no asterisk log there @johnx102, did you forget to paste the link?

Anyways, it’s an authentication issue you’re facing, something isn’t right with your peer details in FreePBX.

Remove all trunk setups in FreePBX linking to your ASTPP server and enter the following chan_sip trunk:

host=
username=
secret=
type=peer
context=from-ptsn
insecure=port,invite
nat=no
qualify=no
disallow=all
allow=alaw,ulaw

with no registration and all inbound details blank since they are covered by the above peer settings populating the host, username and secret lines with your astpp server IP, sip device username and sip device password accordingly. For the purposes of this test, ensure the password on the sip device contains nothing other than alphanumeric characters incase there’s an illegal character there somewhere that asterisk can’t handle.

Don’t add any other options to the peer details than those listed in the example above.

Once you’ve set that up, ensure your outbound route is set to use the correct trunk entry and re-test.

Thanks for answer, i put the asterisk log link, but i regive you .

I will try what you tell and update you .

Thanks

Assuming the username and secret match exactly on both ASTPP and FreePBX, then it appears your ASTPP solution is not picking up the SIP credentials hence the authentication is failing.

I’m guessing you’ve made changes to the sofia profile since your port has been changed. Have you made any changes other than the port?

No change at all.
Default sofia config on default astpp install.
If i put same user on voip phone , its working.
I dont know why with freepbx only ip auth work…

@johnx102 can you share sngrep of astpp and freepbx for 1 outbound call which is not working.