Connect Two FreeSWITCH Boxes

From FreeSWITCH Wiki
Jump to: navigation, search
Warning

Superseded by Confluence

 


Contents

Introduction

You need to connect two FreeSWITCH systems together. How do you do it?

Discussion

There are two ways to do this:

  • IP Authentication
  • Digest Authentication

In short, using IP addresses you can allow one server to call the other using ACLs. All calls get routed through the public context on the destination server. Each server allows the other server to come in via the ACL. No muss, no fuss, just a little XML configuring to do.

Digest authentication means that you have each server have a user with a corresponding gateway on the other server. Instead of setting up ACLs you will create a user on each box, then create a gateway on each box, and have the gateway on Box A register the user on Box B and vice versa. No muss, no fuss, just a little XML configuring to do.

Setup using IP authentication

Let us assume you have BoxA (10.0.0.1) has extensions 1000-1019 and BoxB (10.10.0.1) has extensions 1100-1119.

First we need to make sure that the boxes have access to the talk to each other. This is done in the ACL section (autoload_configs/acl.conf.xml).

On BoxA add the following in the node <list name="domains" ...>

   <node type="allow" cidr="10.10.0.1/32"/>

On BoxB add the following in the node <list name="domains" ...>

   <node type="allow" cidr="10.0.0.1/32"/>


Now the boxes are allowed to talk to each other, they still don't know about the extensions each FreeSWITCH is serving. Therefore you need to tell FreeSWITCH where to send which calls. This is called "routing" and is performed by the bridge application using the internal sofia profile (sip_profiles/internal.xml). Despite the name internal, it will handle calls not for the local switch just fine.

On BoxA add the following lines to the dialplan (dialplan/default.xml)

  <extension name="Dial to BoxB">
    <condition field="destination_number" expression="^(11\d\d)$">
      <action application="bridge" data="sofia/internal/$1@10.10.0.1"/>
    </condition>
  </extension>

On BoxB add the following lines to the dialplan (dialplan/default.xml)

  <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>


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. Therefor a final modification 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)

   <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)

   <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 command:

reloadacl reloadxml

And you should now be able to call 11xx extensions of BoxB correctly from extensions on BoxA and reverse.


Setup using digest authentication

COMING SOON

Conclusion

It's up to you how you wish to accomplish this. Neither method is better or worse. Choose what works for you.

See Also