FREEPBX Connection

Dear Team
I am trying to connect ASTPP V4.01 with FreePBX. I couldnt find any clear instructions.
can you clarify a simple step by step instruction for that.
I would like all calls from ( in and Out) to be billed.

Hi PBXUC,

What have you tried so far?

Also do all calls from the same fbpx install need to be billed on the same ASTPP customer account or not?

Kr,

Jamie

I tried adding in DDI, and pointing it to LOACL ext. ( didnt Work) - To remote FREEPBX (SIP/DDI-Number@xxxxx ServerIP( didnt work).
Also I want calls in the following flow:
1- DDI( in astpp) ==> EXT ( Remote)===>TRUNK ( FREEPBX)===> destination
2- FROM EXT IN ASTPP ==>TO Freepbx Trunk==> destination.
so i want inbound and outbound calls passing through ASTPP. Am using V4.01

In ASTPP you’ll need:

  1. Customer Account Created with the required rate group assigned and sufficient credit available

  2. IP Address of FreePBX added to the customer account.
    (Note: This method will bill all calls coming from the FreePBX box to ASTPP to the customer account, if you need to bill calls to different accounts (multiple customers) on the same FreePBX server, you’ll need to set this up slightly differently).

  3. DID created and assigned to the customer account required

  4. Forwarding set to “DIRECT-IP” and {FreePBX IP Address} as destination.

In FreePBX you will need:

  1. Sip Trunk
    Trunk Name: {Whatever you want}
    Outbound Caller ID: Blank if you have different extensions with different caller IDs or populate with your DID.

PJSIP Settings Tab
Authentication: None (We’ll use IP addresses)
Registration: None (Not required since using IP authentication.
SIP Server: {ASTPP HOSTNAME OR IP}
SIP Port: 5060 (Or whatever port your ASTPP is listening for SIP connections on).
Codecs: ONLY ALAW and ULAW (Unless you’ve manually activated other codecs on ASTPP).

  1. Outbound Route to route the calls via the trunk set.

  2. Extension with outbound caller ID set in the format your ASTPP installation requires.

For inbound calls
Create an inbound route with the DID pointing to your required destination in Freepbx.

Hi and thank you so much for the response, its very much appreciated.
in step 2= I have multiple clients on the FreePBX that I want to bill. may I ask if you can advise me on this.
Thank you so Much

In that case, you will need to not perform the IP authentication and instead use SIP authentication for your outbound calls to ensure they are billed to the corresponding account.

No changes are required for the Inbound path as long as the DIDs are assigned to the account to be billed since the call and billing is all handled on ASTPP before being passed to Freepbx.

NO accounts in ASTPP should have the IP address mapped to it on their customer profile or that account will still receive all charges for calls made from that freepbx box.

For EACH separate customer on ASTPP.
ASTPP:

  1. Create a SIP Device on their customer account for Freepbx to use. ​

FreePBX:

  1. For each SIP device created in ASTPP, create a trunk in FreePBX specifying “Outbound” as the Authentication option and supply the username and password/secret as displayed for the SIP Device in ASTPP.
  2. Create an outbound route for each trunk created and on the dial patterns ensure you qualify the devices that are to use this outbound route by adding their caller ID. Eg: if you wanted to match all numbers except internal freepbx numbers for extensions in the 2100-2199 range to use a route.
    Match Pattern: X.
    Caller ID: 21XX

Calls will then route as follows:
Extension Dials Out > Client Specific Outbound Route > Client Specific Trunk > ASTPP SIP Device > Destination as per ASTPP

Incoming call on DID > DIRECT IP (FREEPBX) > Inbound Route for Number > Destination Specified In FreePBX Inbound Route.

@PBXUC How did you get on? It would be great to get some feedback! :slight_smile:

Hi j. Hope you doing well.
Apologise didnt get back to u yesterday to thank you for your instructions. So thank you.
I will get on it now and test it.
Also can I pm you.

1 Like

No problem! I haven’t saw a PM function on here, but feel free to reach out to me at support@[myusername].com

I’d also recommend keeping your postback of your results on here so as to help others if they have a similar question.

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.