Route calls to a remote server

Hi everyone,
i’m very happy to join the community. I have some problems with my Freepbx configuration.
Thank you for helping me set up my FreePBX server. My current configuration is as follows:

  • FreePBX 15 (Asterisk 16) with 2 network cards (ETH0 and ETH1).

  • eth0 has a private IP address 192.168.XX.XX (LAN) and eth1 has an IP address provided by the SIP operator. eth1 connects to the SIP provider server via a gateway address provided by the SIP provider.

  • So I’ve created a permanent static route to route the traffic on eth1 to the SIP provider’s server. In the freepbx web interface

  • I’ve created a trunk (pjsip with from-pstn as context) between freepbx and the SIP provider (which is ip-based authentication).

-I’ve created an outbound route to be able to make calls to the outside from said trunk.

  • To receive calls, I’ve created a ring group (with extensions numbered 2XX) which is the destination of my inbound route

  • and I use a softphone (microsip) to dial numbers and pick up calls.

Everything is working well, so far. Each extension can communicate with the other extensions and can also make and receive calls from the outside via the SIP provider’s trunk.

what i want to do now is:

  • to connect my FreePBX server to a PBX server (Bitrix24) via the Internet and be able to make and receive calls through the Bitrix24 website. To do this, I’ve created a trunk (PJSIP with from-internal as context) between FreePBX and Bitrix24. I’ve created this trunk by entering the login, password, and ip address of my freePBX (public address of my router) in bitrix24 and I did the same with the login, password, and server address of bitrix24 (which is a public address) in freepbx.

-The trunk is online.

  • I can make calls from the Bitrix24 website.

  • I can call a local extension of my FreePBX from bitrix24, and I can make calls to the outside from bitrix24 through the trunk of the SIP provider.

But here comes the issue :

  • I can’t call extensions created in Bitrix24 from a local FreePBX extension, and I can’t route incoming calls (provider DID) that arrive on my freepbx to Bitrix24 so I can pick them up from the website !!!

Thank you for your concern and apologize for the length of the message and for my not very correct English.

you need to setup a separate outbound route that has the proper dial string for your bitrix24 extensions.

Thanks Ashcortesh,
but i’ve already tried this. Set an outbound route with the trunk between my PBX and Bitrix24 as Trunk Sequence for Matched Routes, and enter the correct dial patterns according to bitrix24 extensions number, but no result.
it seems to me like bitrix24 extensions work as remote extensions, i think it should be the same extensions numbers as in freepbx. I’m not sure of that

they should be different extension schemes… If not there is no way that freepbx can know to route out of the system.

Example

FreePBX 201-210
Bitrix24 301-310

and then have the dial patterns for the bitrix24 outbound route be 3xx

Please show your dial patters for each of your outbound routes.


Here is the dial pattern of outbound route (the SIP provider trunk to dial outside)

here is the dial pattern that match the bitrix24 trunk

your sip trunk provider route is taking all the calls… you can’t have xxxxxxxxxxx as your only dial pattern, it basically says “any number”

What order are these listed in your list? The phone system evaluates an outbound call top to bottom of that list and uses the first one that matches.

It should only match any number of exactly 10 digits.

yes… I stand corrected.

thank you guys for your help…it’s a little bit difficult for me to explain clearly what is the issue i’m facing as english is not my first language… but let me try :grin:
the dial pattern XXXXXXXXXX for the first outbound route is to dial any number of ten digits (as we have 10 digits number here in my country). so if i want to make or receive a call through the provider trunk, it should be a ten digits number. i’ve created extensions (connected on a softphone) and a ring group (as inbound calls destination), so when people dial the number gave by the provider (i think it’s called the DID), my softphone rings and i can answer. everything is fine on that side.

my goal now is to be able to make and answer calls through bitrix24 which has a cloud pbx connected to my freepbx through PJSIP trunk.
On bitrix24 telephony system i can create extensions where i’m supposed to send incoming calls.
At present, bitrix24 pbx is well connected to my freepbx server (PJSIP trunk, with from-internal context), and i’ve forwarded required ports on my router, and i can make calls from bitrix24 website. the call goes to my freepbx and use the provider trunk to dial out the number i want to call (ten digits number). I’m also able to call from bitrix24 website an extension of my freepbx.
The problem is that i cannot call back from my local extensions to bitrix24, or route calls that come through provider trunk to bitrix24 website in order to pick up the calls there.

My assumption is that the extensions on bitrix24 pbx, should be the same with those on my freepbx, and so the extensions should appear online in asterisk info of my freepbx server (as if i was connecting my extensions remotely).

Hello Alban,

Were you able to resolve this?

I’m trying to do the same thing as you, but having issues creating the pjsip trunk to Bitrix24 on freepbx. I have the login, password and IP of my bitrix server, but don’t know where to input it on the freepbx page, or where to generate same to input in the bitrix24 page.

Could you please share you pjsip trunk setup page so I can see where I am missing it?

I would really appreciate if you could do that.

Thank you.

Hello Grace,
You can follow these steps :

  1. go to your freepbx GUI interface
  2. click on connectivity
  3. click on trunks
  4. now click on add trunk, and select add SIP (chan_pjsip) trunk
  5. in General tab, just put a name in the trunk name tab
  6. go to pjsip settings and add bitrix24 login in username and bitrix24 password in secret
  7. past your bitrix24 server ip address in the Sip server tab (you can leave sip server port blank, it will use the default sip port)
  8. use from-internal as context
  9. submit and apply config

The second part is to enter your freepbx credentials in bitrix24 office PBX :

  1. go to telephony in your bitrix24 account (you can type it in the search bar)
  2. click on office pbx and connect office pbx
  3. you will be asked for some information
  • connection name (enter what you want)
  • server address (IP address of your PBX which might be a public address instead of the local one. if your freepbx is behind a NAT router, so it is the wan ip address of that router)
  • login and password (in my case, i’ve used the admin credentials which i use to connect to my freepbx GUI interface, i could be wrong)
  1. click on save and you will be done

If everything is ok, you should see that your trunk is up in asterisk info.

P.S: if your freepbx is behind a NAT, don’t forget to enter your router public IP in asterisk sip settings, and forward sip port to listen on, and the RTP port ranges to your freepbx local ip.

Hope it will help you, and also that some experts will corrects mistakes i’ve made !

Thank you so much.

I truly appreciate this.

I will implement and revert on if it solves my problem.

Thanks.