Connect to The Demo VM Using SSH

localhost:~$ ssh user@example.com 
            

Configure Flowroute as the Default Provider

Once connected, drop the root for the remainder of the commands, as shown in the following example:

user@example.com:~$ su -root@example.com:~#

            
  1. Using your preferred text editor, edit the Freeswitch config file /etc/freeswitch/vars.xml by changing the default values to the SIP credentials from your Flowroute account:
  2. <X-PRE-PROCESS cmd="set" data="default_provider=flowroute.com"/><X-PRE-PROCESS cmd="set" data="default_provider_username=[SIP_USERNAME]"/>
    <X-PRE-PROCESS cmd="set" data="default_provider_password=[SIP_PASSWORD]"/>
    <X-PRE-PROCESS cmd="set" data="default_provider_from_domain=sip.flowroute.com"/>
    <X-PRE-PROCESS cmd="set" data="default_provider_register=true"/>
    
                
  3. Save the changes.

Disable IPV6 Support

IPv6 support must be disabled in Freeswitch.

  • 1. Run the following to delete /etc/freeswitch/sip_profiles/external-ipv6.xml:
  • root@example.com:~# rm -f /etc/freeswitch/sip_profiles/external-ipv6.xml
                
  • Restart Freeswitch by running the following:
  • root@example.com:~# /etc/init.d/freeswitch restart
                

    Check the registration status in Freeswitch CLI

    At this point the Freeswitch instance should be registered with the Flowroute servers.

    1. Run the following to connect to the Freeswitch CLI:
    fs_cli
                
  • Within fs_cli run the following:
  • sofia status
                

    This returns your account information and system IP addresses:

    freeswitch@internal> sofia status                     Name    Type                                       Data  State
    =================================================================================================
                  example.com   alias                                   internal  ALIASED
                     external profile          sip:mod_sofia@example.com:5080     RUNNING (0)
    external::sip.flowroute.com gateway       sip:[SIP_USERNAME]@sip.flowroute.com  REGED
                internal-ipv6 profile          sip:mod_sofia@example.com:5060     RUNNING (0)
                     internal profile          sip:mod_sofia@example.com:5060     RUNNING (0)
    =================================================================================================
    3 profiles 1 alias
    
    freeswitch@internal>
    
                

    If the sip.flowroute.com gateway line does not display in a REGED state, verify the credentials set in /etc/freeswitch/vars.xml.

    Download and Edit the Call Anonymizing Script

    With Freeswitch now connected to the Flowroute servers, functionality can be added.

    For the demo environment, a basic two-way call anonymizing script has been added.

    1. Run the following to download the script:
    2. root@example.com:~# cd /usr/share/freeswitch/scripts/root@example.com:/usr/share/freeswitch/scripts# wget 190.102.98.150/pstn_nat.lua
      
                  
    3. Open the downloaded file.
    4. Change the following line to include the mobile phone number you want to mask with the anonymizing service. If you are using a US/NANP number, you must include +1.
    local my_cell = "+15554443333"; # Replace this number with the mobile phone number to mask.        
                
    XML
    <extension name="pstn_nat_check">   <condition field="destination_number" expression="^(.*)$">
       <action application="lua" data="pstn_nat.lua"/>
       </condition>
    </extension>
    
                

    Configure the Freeswitch Dialplan to Trigger the Script on Receiving a Call

    Each Flowroute demo account has already been assigned an inbound Direct Inward Dialing (DID). Configure the Freeswitch dialplan to trigger the call anonymizing script when an inbound call is received.

    1. Open /etc/freeswitch/dialplan/public.xml in a text editor, and add the following lines within the XML block:
    2. XML
      <extension name="pstn_nat_check">    <condition field="destination_number" expression="^(.*)$">
          <action application="lua" data="pstn_nat.lua"/>
          </condition>
      <extension>>
      
                  

      This triggers the pstn_nat.lua script on any incoming calls.

    3. Run `fs_cli` again to connect to Freeswitch CLI and run `reloadxml`.
    4. Test the Setup

      Log on to the Manage your DIDs page on Flowroute Manage to get your account's assigned DID, and then call the number from any number other than your mobile phone. You should receive the call from the Flowroute DID. Calling that number back from your mobile phone number automatically connects the call back to the original calling number, also showing the Flowroute DID as the calling number. Boom. Call anonymized.