Disclaimer

This information HAS errors and is made available WITHOUT ANY WARRANTY OF ANY KIND and without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is not permissible to be read by anyone who has ever met a lawyer or attorney. Use is confined to Engineers with more than 370 course hours of engineering.
If you see an error contact:
+1(785) 841 3089
inform@xtronics.com

Freeswitch


freeswitch

Installation

There is a Debian repository at:

deb http://files.freeswitch.org/repo/deb/debian/ jessie main

The sad part is they don't have a listed keyring so you have to say yes when it complains "WARNING: The following packages cannot be authenticated!"

After adding the repository there will be 286 packages added ( we are now in the days of TB hard drives - should have been just a few packages )... Installing a metapackage is the only sane thing to do. I would start with installing all of these - be aware that several of the 'suggests' are not available packages..

You will also need to install one of the configs:

create /etc/freeswitch and copy over the configs which supply what the book calls the default config - provides the examples in the book.

I also had to install freeswitch-sounds-en-us-callie and freeswitch-music-default freeswitch-sysvinit


You will need to set <param name="liberal-dtmf" value="true"/> to use linphone for the example ivr.

Firewall Issues

http://www.shorewall.net/Helpers.html

https://home.regit.org/netfilter-en/secure-use-of-helpers/

http://www.shorewall.net/traffic_shaping.htm

http://shorewall.net/manpages/shorewall-tcrules.html

Syntax

${var} is expanded as it's encountered in the dialplan. The confusion is that a "double dollar sign" $$ does NOT mean what it does in php. "Twin dollar signs" are pre-expanded during load or reloadxml and don't change. "2 dollar sign" just for search engines as $$ is not search-able.

Also - be aware that for some reason one can not comment out an X-PRE-PROCESS line, instead change to X-NO-PRE-PROCESS ( IMO this is bad form - could be fixed ).

Directory

A directory entry is needed to allow a user to register with freeswitch

Dial Plan

fs_cli

$ Show channels

then with

$ uuid_dump UUID 
$ global_getvar  
$ global_setvar varname=value
$ eval ${domain}
$ freetdm list
$ cd /etc/freeswitch
$ find . -name \*.xml -type f -exec xmllint --noout {} \;

Config snippets

These config bits assume that freeswitch is sanely behind a firewall ( shorewall) on the LAN side with DNAT holes for the freeswitch server in 'rules'.

DNAT net loc:FSserverIP tcp 5060:5080,sip-tls
DNAT net loc:FSserverIP udp sip-tls,5060:5080,16384:32768


autoload_configs

Dialplan Notes

There can also be a continue=true in the extension tag, which allows the parsing of further extensions. The following extension will continue on to more extensions even if the contained condition matches!

 <extension name="tod_example" continue="true">
 <condition wday="2-6" hour="9-18">
	<action application="set" data="open=true"/>
 </condition>
 </extension>

The condition is an IF true then do till end of condition tag/

 <condition field="variable" expression="value" >
 <!-- if variable = value then run application-example with application-parameters -->
 <action application="application-example" data="application-parameters"/> 
 <action application="application-example2" data="application-parameters2"/> 
 </condition>

You can add a break= at the end of a condition statement that tells it to test the rest of the extension's conditions BUT never use break never with stacked conditions ( for ANDing conditions )


To do an ANDed condition - note the closing tags of the condition lines - they matter.

  <condition field="variable1" expression="value1"/>
  <condition field="variable2" expression="value2">
 <!-- this action only gets set if both (could be more) conditions above evaluate are true -->
 <action application="set" data="variable=true" inline="true"/>
  </condition>

To do an 'ORed condition one could create two extensions or do a break="on_true" and have a second test with the identical application line. (not pretty)

To negate the condition ( lets say we want to do something if the field is NOT 2)

 <condition field="variable2" expression="2"/>
  <anti-action application="set" data="open=true"/>
 </condition>

An EXOR apparently requires the setting of a variable and use of inline (see below).

(It would have been cool if things like this were legal: <condition field="variable" expression="value" & field="variable2" expression="value2"> where the and sign could be an '|' OR or EXOR and one could negate with an '!' But this is not so as of 2013-07)

To make changed variables true for the next extensions evaluation one needs to add inline="true" to the action expression.

To match anything:

expression="(.*)"

SIP Profiles

Unless you are doing some kind of fall-over support or multi-home just stick to the demo setup where the domain maps to the FS IP address. Do the the ability to configure FS in powerfully abstract ways, there are several settings that need to be understood.

As an example - we have a FS box sitting sanely behind a firewall with a private rfc1918 IP set to 192.168.1.100 - the public IP is 123.123.123.123 and the firewall has appropriate ports VNATed

A dump of $ sofia status :

 sofia status
 Name Type Data State
=================================================================================================
 external profile sip:mod_sofia@192.168.1.100:5080 RUNNING (0)
 192.168.1.100 alias internal ALIASED
 internal profile sip:mod_sofia@192.168.1.100:5060 RUNNING (0)
 external::provider.com gateway sip:1234567890@provider.com REGED


Each profile services incoming connections for one port over one IP address and any number of gateways (See below). The listing tells us that from FS point of view that the internal profile LAN calls on 192.168.1.100:5060 and external calls from the public internet have the same IP only the port number is 5080.

The IP 192.168.1.100 is aliased to the internal profile

Profiles also contain a variety of parameters that control their operation.

Profile names "internal" and "external" are just labels that try to give you a basic idea of their use. You could create others for special purposes.


Demo internal profile

The Internal profile is intended for registering phones on the LAN. The port number is set in vars.xml and is used to set the port number that the internal profile listens on ( look for $${internal_sip_port} - The internal and external ports are set in vars.xml )

There are many parameters that can be set to support different call features.


Demo External Profile

The external profile is mainly for external gateways. It is set up to use a different port number. $${external_sip_port}


Gateway

A gateway is a registered connection to providers to provide incoming calls(DID) and out bound calls. Just as a SIP phone registers with FS - Freeswitch can register to other servers.

Alias

Normally the internal profile uses port 5060. These would be for calls behind a LAN. Internal profiles use sip-ip and rtp-ip

under construction

ext-rtp-ip ext-sip-ip nat.auto and auto-nat acl


Top Page wiki Index

Email

(C) Copyright 1994-2019
All trademarks are the property of their respective owners.