Create a gateway that uses the internal dialplan

Status
Not open for further replies.

chopsywa

New Member
Sep 23, 2024
12
1
3
63
I have a IP PBX behind my FusionPBX (FreePBX). I want the Fusion PBX to treat this IP-PBX as internal, so when calls come from the second PBX, they behave the same as calls made from extensions. I.E. They route out through our external gateway and allow intercom functionality between the two PBXs. I can't see to find any way to make this work. No matter what I put in the context of the gateway incoming calls from the second PBX fail as they are trying to use the public dialplan as shown in the log.

2024-10-14 18:21:21.693156 94.63% [INFO] mod_dialplan_xml.c:639 Processing Mark Dutton <501>->101 in context public

Is this not doable? it seems like a straightforward config and I have done it many times in other switches.

Outbound routing to the other PBX is a piece of cake and working fine.

Cheers
 

hamagid

Member
Dec 14, 2020
78
8
8
33
have you tried creating a extension in fusion and use it as a gateway with registration in freepbx?
 

chopsywa

New Member
Sep 23, 2024
12
1
3
63
I haven't tried this. I suspect it might work, but it is very inelegant. It would also require me to create two sip trunks on the remote PBX as I couldn't route multiple extension outbound through a single extension.
 

chopsywa

New Member
Sep 23, 2024
12
1
3
63
I have found a partial answer. I can create a user bridge, but this only allows the remote pbx to call user extensions, not groups etc.

I am sure I could write manual diaplan rules to get it to work (maybe), but if the trunk could be deemed internal instead of public, then it would simply be connected to the internal dialplan. is there a funky way to configure a bridge so it simply connects to $1 in the internal dialplan? Profile and loopback do nothing useful that I can see, so that leaves gateway and user. Gateway is obviously for routing back out again, so that leave only user so far as I can see.
 

ad5ou

Active Member
Jun 12, 2018
892
204
43
It's been a long time since I've had to build a trunk to another PBX, but the general answer is to have the other pbx connect to Fusionpbx as an extension as well as custom bridge entry to route calls to the other pbx.

See the following post on how I connected our fusionpbx to an old Grandstream UCM. Shouldn't be a huge leap to setup similar options in a freepbx dial plan.
 
  • Like
Reactions: chopsywa

chopsywa

New Member
Sep 23, 2024
12
1
3
63
Yeah thanks. I have done similar using a trunk instead of an extension. I'll give it a try your way. If FusionPBX allows me to send multiple destinations through the extension, this will work. It would be nice if you could simply define a trunk as internal and create an inbound route to a number range. As it is you can create a gateway and put in your in internal context, but it still ends up being public, so not sure why the field is even there.
 

chopsywa

New Member
Sep 23, 2024
12
1
3
63
I gave your method a try, but no luck so far. Where i am stuck is even if I use an extension (199 in this case), calls coming from that extension are still being resolved as in the public context. I can't figure out what makes Freeswitch think this is the case.

2024-10-16 13:13:43.813146 96.40% [INFO] mod_dialplan_xml.c:639 Processing 199 <199>->101 in context public

EDIT: Argghh. Found it! I had initially put Fusion behind the Freepbx and it was in my list of providers in ACL. This forced it to public context. Time to start again. Doh!
 

chopsywa

New Member
Sep 23, 2024
12
1
3
63
@ad5ou , you are a legend! This works perfectly.

Could you please explain the part of the string in bold italics that you used to send the ultimate destination and where you found this information?
sofia/internal/sip:$1${regex(${sofia_contact(3211112233@customer.domain.com)}|^[^@]+(.*)|%1)}
 
Last edited:

ad5ou

Active Member
Jun 12, 2018
892
204
43
@ad5ou , you are a legend! This works perfectly.

Could you please explain the part of the string in bold italics that you used to send the ultimate destination and where you found this information?
sofia/internal/sip:$1${regex(${sofia_contact(3211112233@customer.domain.com)}|^[^@]+(.*)|%1)}
The magic bridge statement came from these forums long ago. Without getting into the raw details of regex, it is adding in the correct contact information of the registered endpoint.
 
Status
Not open for further replies.