Skip to content

How To: Freeswitch Tutorial Multi-Homed (Dual NIC) Server

by Jon on June 27th, 2010

This tutorial was created from an install of Freeswitch 1.0.6 on Centos 5.5 using the sample configuration files. The system has eth0 on the public network using dhcp and eth1 was on the private network using a static ip address.  Depending on your setup some changes to this configuration may be necessary. This tutorial assumes you have a sip phone connected to the system and using extension number 1000 for inbound and outbound dialing. The default install location for conf directory was used, /usr/local/freeswitch/conf.

1.    Open vars.xml with your favorite text editor located in the conf directory and make the following changes and additions to the file.

Look for the domain veriable and change this to your public ip address or public dns name.
<X-PRE-PROCESS cmd=”set” data=”domain=(YOUR PUBLIC IP OR DNS)”/>

Down at the bottom of vars.xml add these variables in the external and internal sections of the configuration flie. In this example $${local_ip_v4} is the public ip address of the system, in your case it may or may not be, is the private ip address being used for the internal network.

<X-PRE-PROCESS cmd=”set” data=”external_sip_ip=$${local_ip_v4}”/>
<X-PRE-PROCESS cmd=”set” data=”external_rtp_ip=$${local_ip_v4}”/>

<X-PRE-PROCESS cmd=”set” data=”internal_sip_ip=″/>
<X-PRE-PROCESS cmd=”set” data=”internal_rtp_ip=″/>

2.    Next the external and internal sip configurations need to be edited so open sip_profile/external.xml first and uncomment the following lines.

<param name=”force-register-domain” value=”$${domain}”/>
<param name=”force-register-db-domain” value=”$${domain}”/>
<param name=”dbname” value=”share_presence”/>
<param name=”presence-hosts” value=”$${domain}”/>

Then open sip_profile/internal.xml and uncomment the same lines.

<param name=”force-register-domain” value=”$${domain}”/>
<param name=”force-register-db-domain” value=”$${domain}”/>
<param name=”dbname” value=”share_presence”/>
<param name=”presence-hosts” value=”$${domain}”/>

3.    Now a sip provider needs to be added to your external sip profiles, so open sip_proflie/external/example.xml in here make the necessary changes to this file to connect to a sip providor. There are many tutorials on how to add a sip provider to freeswitch that will not be covered in this tutorial. Change the gateway name to “multi-example” to match the setup of this tutorial.

<gateway name=”multi-example”>

4.    The next step will be routing the inbound DID from the sip provider setup in step 3. In order for the system to route the DID properly it needs to be specified in the following dialplan configuration file: dialplan/public/00_inbound_did.xml.  Change the expression value in the destination_number variable to match what the sip provider is passing, this typically will be the 10 digit number in the US.

Before:  <condition field=”destination_number” expression=”^(phonenumber)$”>
After:  <condition field=”destination_number” expression=”^(4075551234)$”>

5.    In your dial plan you have to specify your outbound route to use the gateway you setup edit this block in dialplan/default/ The final configuration change to get the system up and running will be to add the sip provider added in step 3 to the default outbound route. Open the file dialplan/default/ and make the following change to the domestic outbound route.

Edit the <extension name=””> xml block.

Before: <action application=”bridge” data=”sofia/gateway/${default_gateway}/$1″/>
After: <action application=”bridge” data=”sofia/gateway/multi-example /$1″/>

6.    The last step is to do a full reload and a sip reload with the following commands in the freeswitch cli, fs_cli.

> reloadxml
> reload mod_sofia
Or just do a full restart of freeswitch.

Now all of these changes have been made you should be able to call your DID number and it will ring into your sip phone with extension number 1000 and that phone should also be able to dial out through the sip provider using 11 digit dialing 1+10 digit US number.

From → VOIP

  1. GAIL permalink

    Very interesting!!!!!

  2. Thanks so much for your useful Article. Really great topic to write about on my blog. I probably make a bookmark from another Blog.

  3. This is the reason I keep returning to this site. I can not believe how many entries I missed since my last visit!

  4. What a wonderful article. I intend to make your blog part of my daily reading.

  5. Thank you for a great post.

  6. Great site you have here but i seem to be having a problem looking at your RSS feed. Everytime i click it it comes up with error 404. It might be my own Laptop. I have Windows 2000 with bullguard AntiVirus. Im not sure if its enabled. Let me know if anyone else has mentioned any Problems or its just me. Im not too good with netbooks. I cant see my writing after submitting so im not sure if you will see this. Ill bookmark your site and check by in a couple of days for an answer. Please let me know if you know of a way around it

  7. it was very interesting to read.
    I want to quote your post in my blog. It can?
    And you et an account on Twitter?

  8. Hey , you have a really great blog , I’m going to put a link to it on my site, so I will send you some quality traffic :) Cheers!

  9. Hell Yeah….Just what i was browsing for….it took me a while but you hit the nail on the head…wonderful read…A+

  10. Nice tutorial. I was looking for this…

  11. Read it, and I’ll implement it for sure.

  12. Thank you it was interesting and I love the way you go into details.

  13. have already been following ur website for 3 days. really enjoy your posts. by the way i’m doing research about this area. do you happen to know any great sites or perhaps online forums that I might get more information? thanks a lot.

  14. very good info presented here, comments can be used to learn as well

  15. Tim permalink

    Newbie to Freeswitch
    I would like to get my hands into this setup but would like some more info. What extra hardware do I need to “sip phone connected to the system”.

    I am assuming I have to get rid of the standard phone.

    Regards Tim

    • Yes you would need some sort of SIP phone, this can be anything from a hardware phone like a polycom, an ATA device that will allow you to use an analog phone, or even the xlite soft phone that is free and can be installed on a computer.

      If you have any other questions go right ahead.


      • Tim permalink

        Thank you for your very quick response. Reading through my last question I realise that I was not so clear. I do apologise.

        What I wanted clarification with is:
        Say I have this dual-homes CentOS acting as a perimeter server (Firewall/router) for my network like so:
        87.x.x.91-94 |
        | 87.x.x.90
        Private—————–|LAN (NAT)

        Am I right to assume that the sip-hardphone would be plugged as a LAN device, and thats it or do I need any PCI card in the CentOS/FS?

        Regards Tim

        • Tim you would be able to have anything on your private network communicate with the private interface on the CentOS box. So your CentOS box should have 2 NIC cards, 1 for public at 87.x.x.90 and 1 private at, then all your private SIP devices should use as the sip server. Please see the below diagram.

          Internet—> Modem—> CentOS—> Private Switch—> SIP Phone

  16. Chris permalink

    Just in case anyone else runs into this…

    I had to modify two additional lines in $prefix/conf/sip_profiles/internal.xml

    • Thanks for the note, what did you modify so i can update the post?


  17. Aaron permalink

    Hi Jon, i hope you are doing well

    Im very noob in FS, and I have a very similar scenario, let me explain:

    1. eth0 Private Network (for FS and PHONES)
    2. eth1 Public Network (for PSTN)

    I follow your tutorial but I obtain this results when I call to another extensions:

    2015-02-27 19:38:20.790622 [INFO] mod_dptools.c:3234 Originate Failed. Cause: USER_NOT_REGISTERED
    2015-02-27 19:38:20.790622 [NOTICE] switch_channel.c:4724 Hangup sofia/internal/1005@ [CS_EXECUTE] [USER_NOT_REGISTERED]

    My Freeswitch version is 1.4.15


Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

%d bloggers like this: