IMT
About
An Inter-Machine Trunk sends calls from one FreeSWITCH™ box to another. All calls get routed through the public context on the destination server. Each server allows the other access via the Access Control List (ACL).
IP authentication
Let us assume you have BoxA (10.0.0.1) with extensions 1000-1019 and BoxB (10.2.2.2) has extensions 1100-1119.
First we need to make sure that the boxes have access to talk to each other. This is done in the ACL (access control list) section (autoload_configs/acl.conf.xml).
On BoxA add the following in the node <list name="domains" ...>
<node type="allow" cidr="10.2.2.2/32"/>
On BoxB add the following in the node <list name="domains" ...>
<node type="allow" cidr="10.0.0.1/32"/>
Dialplan
Outbound
Now that the boxes are allowed to talk to each other, they still don't know about the extensions each FreeSWITCH is serving nor how to reach the other FS box. Therefore you need to tell FreeSWITCH where to send which calls. This is called "routing" and is performed by the dialplan using the bridge application. This example uses the internal sofia profile (sip_profiles/internal.xml). Despite the name internal, it will handle calls destined for another switch just fine.
On BoxA add the following lines to the dialplan (dialplan/default.xml)
BoxA Outbound Dialplan
<extension name="Dial to BoxB">
<condition field="destination_number" expression="^(11\d\d)$">
<action application="bridge" data="sofia/internal/$1@10.2.2.2"/>
</condition>
</extension>
On BoxB add the following lines to the dialplan (dialplan/default.xml)
BoxB Outbound Dialplan
<extension name="Dial to BoxA">
<condition field="destination_number" expression="^(10\d\d)$">
<action application="bridge" data="sofia/internal/$1@10.0.0.1"/>
</condition>
</extension>
Inbound
Now calls are sent (routed) from the originating switch to the destination switch and thanks to the ACL, it is allowed. However the destination switch does not know what to do with the call as for him it is a public call. Therefore an inbound dialplan entry is needed to make it work. We tell FreeSWITCH to route it through the normal default dialplan.
On BoxA add the following lines in the public dialplan (dialplan/public.xml)
BoxA Inbound Dialplan
<extension name="Calls from BoxB">
<condition field="destination_number" expression="^(10\d\d)$">
<action application="transfer" data="$1 XML default"/>
</condition>
</extension>
On BoxB add the following lines in the public dialplan (dialplan/public.xml)
BoxB Inbound Dialplan
<extension name="Calls from BoxA">
<condition field="destination_number" expression="^(11\d\d)$">
<action application="transfer" data="$1 XML default"/>
</condition>
</extension>
On both machines, run the following commands:
reloadacl
reloadxml
You should now be able to call 11xx extensions of BoxB correctly from extensions on BoxA and vice-versa.