Tag Archive for 'freeswitch'

FreeSWITCH: listen on UDP only

As a default behavior, FreeSWITCH SIP profiles listen both on TCP and UDP. To disable any of them, use bind-params in /conf/sip_profiles/some_profile.xml

https://wiki.freeswitch.org/wiki/Sofia.conf.xml#bind-params

FreeSWITCH installation

Download latest stable release (January, 2014) http://files.freeswitch.org/freeswitch-1.2.17.tar.bz2 to /usr/src/.
I have the basic Debian 7.3 Wheezy installation.
I needed these dependences: apt-get install zlib zlib-dev zlib1g-dev libjpeg62 libjpeg62-dev libjpeg8-dev libcurses-perl libncurses5-dev libssl-dev

Then:

./configure

make install
make cd-sounds-ru-install
make cd-moh-ru-install
make cd-moh-install

Symlinks:
ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/fs_cli
ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/freeswitch

Fire!:
fs_cli -l 5

FreeSWITCH: dial through VoIP provider

Register against megavoip.com sbc:
Add a file sip.megavoip.com.xml to /usr/local/freeswitch/conf/sip_profiles/external/ to dial through Megavoip.com:

fs-megavoip

Register against multifon.ru sbc:
Add a file multifon.xml to /usr/local/freeswitch/conf/sip_profiles/external/ to dial through multifon.ru:

fs-multifon

Now it’s time to check if the REGISTER is OK.
Execute in the FS CLI:

freeswitch@internal> sofia status
Name Type Data State
=================================================================================================
external profile sip:mod_sofia@10.145.13.21:5080 RUNNING (0)
external::example.com gateway sip:joeuser@example.com NOREG
external::sip.megavoip.com gateway sip:megavoip_username@sip.megavoip.com REGED
external::multifon gateway sip:79221234567@sbc.multifon.ru REGED
10.145.13.21 alias internal ALIASED
internal profile sip:mod_sofia@10.145.13.21:5060 RUNNING (0)
internal-ipv6 profile sip:mod_sofia@[::1]:5060 RUNNING (0)
=================================================================================================
3 profiles 1 alias

or:
freeswitch@internal> sofia status gateway
Profile::Gateway-Name Data State IB Calls(F/T) OB Calls(F/T)
=================================================================================================
external::example.com sip:joeuser@example.com NOREG 0/0 0/0
external::sip.megavoip.com sip:megavoip_username@sip.megavoip.com REGED 0/0 0/0
external::multifon sip:79221234567@sbc.multifon.ru REGED 0/1 0/0
=================================================================================================
3 gateways: Inbound(Failed/Total): 0/1,Outbound(Failed/Total):0/0

or with more info:
freeswitch@internal> sofia status gateway sip.megavoip.com
...

Dial through (let’s dial via megavoip.com):

Add to /usr/local/freeswitch/conf/dialplan/default.xml to the beginning of ‘default’ context:

fs-dial-through

FreeSWITCH and Asterisk: equivalent commands

fs_cli -l 5 = console loglevel 5

sofia global siptrace on|off = calls debug

console loglevel help
console loglevel [0-7] = core set verbose X

sofia profile default start

sofia status profile internal
sofia status profile internal reg = sip show peers. Show devices, registered against your FreeSWITCH
list_users = sip show peers. Show devices, registered against your FreeSWITCH

sofia profile internal rescan = sip reload (not sure! Command below is BETTER!)
sofia profile external restart reloadxml = equivalent of ‘sip reload’. Execute after editing /usr/local/freeswitch/conf/sip_profiles/external (or internal)

F6 = dialplan reload
reloadxml

xml_locate dialplan = dialplan show

reload mod_sofia

http://wiki.freeswitch.org/wiki/Rosetta_stone

FreeSWITCH unexpected behavior

FreeSWITCH is a new telephony engine for me, so I’m just learning it when I have free time.
Today I discovered a 'system' command in FS CLI and for the sake of curiosity typed 'system ping 8.8.8.8'. Nothing changed in the CLI.
Some time later I started to learn how to reload the SIP stack of FreeSWITCH ('reload mod_sofia'). And each time I saw an error:

...
2014-01-04 09:02:57.468709 [ERR] sofia.c:1501 Error Creating SIP UA for profile: internal
2014-01-04 09:02:57.468709 [ERR] sofia.c:1501 Error Creating SIP UA for profile: internal-ipv6
2014-01-04 09:02:57.468709 [ERR] sofia.c:1501 Error Creating SIP UA for profile: external
...

All of SIP-profiles failed when restarting them.

I started searching – who is listening on port 5060. That’s what I’ve discovered:
root@server:/opt/freeswitch/bin# netstat -tulpan | grep 5060
tcp 0 0 10.15.9.10:5060 0.0.0.0:* LISTEN 6887/ping
udp 124576 0 10.15.9.10:5060 0.0.0.0:* 6887/ping

My ping, that 'system' application. I killed it and restarted FreeSWITCH. After that everything works fine.