** Please note I'm using Ubuntu distributions for all of the tutorials.
1. Download FreeSWITCH
You can download FreeSWITCH source codes from: http://files.freeswitch.org/
If you installed non-x-desktop distribution, you can alternative download files using :: wget http://files.freeswitch.org/FILENAME command line.
2. Copy file to /usr/src directory
Run cp FILENAME /usr/src from command line.
3. Uncompress source code - tar.gz files in my case
Goto /usr/src using cd /usr/src command and run tar -xzf FILENAME - It will generate freeswitch-VERSION folder (1.0.3 in my case).
4. Install prerequisites
Run apt-get install build-essential subversion subversion-tools automake1.9 gcc-4.1 autoconf make wget libtool g++ libncurses5 libncurses5-dev for all-in-one installation or prerequisites for FreeSWITCH.
5. Configure source code
Goto /usr/src/freeswitch-1.0.3 directory and run ./configure. It will configure make files according to your linux specs.
6. Make binaries
Run make command to make bianaries
7. Install FreeSWITCH
If you did not have any problem with make binaries, now its time to install your FreeSWITCH. Run make install command and it will install your FreeSWITCH under /usr/local/freeswitch directory.
8. Install sound files
Run make sounds-install moh-install to install FreeSWITCH's default sound files and music-on-hold (moh) files.
9. Run FreeSWITCH for the very first time
Goto /usr/local/freeswitch/bin and run ./freeswitch command. It will run a command-line version of freeswitch! You're now ready to enter FreeSWITCH's world!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
In this tutorial assumes you've installed FreeSWITCH on your computer/server.
------------------------------------------------------------------------
Now, its time to set your internal profiles (extensions) for your FreeSWITCH.
FreeSWITCH calls extension/login accounts as Directories, these configurations can be found under /$PREFIX/conf/directory
There are several configuration files under /$PREFIX/conf/directory directory. Now we open 1000.xml file to set a extension:
- Open 1000.xml under directories directory
- Your 1000.xml file should look something like:
Code: |
<include> <user id="1000" mailbox="1000"> <params> <param name="password" value="1234"/> <param name="vm-password" value="1000"/> </params> <variables> <variable name="accountcode" value="1000"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="Extension 1000"/> <variable name="effective_caller_id_number" value="1000"/> </variables> </user> </include> |
- For <user id="1000" mailbox="1000"> defines your user name (extension number)
- For <param name="password" value="1234"/> defines your password.
- For <variable name="effective_caller_id_name" value="Extension 1000"/> defines your caller name.
- For <variable name="effective_caller_id_number" value="1000"/> defines your caller id number.
- Here, change your password for extension 1000, and save your file.
- Restart your FreeSWITCH
- If you completed above steps, now its time to download a softphone onto another computer. This is due to you cannot run softphone and IP PBX/softswitch on the same machine. I would recommend x-lite client from http://www.counterpath.com - Free but it does all of the functions
- Connect your client to internal IP address of your FreeSWITCH (Use port 5060 if you have specify port number), place your username & password.
- If you get connected (authenticated), you are now connected to FreeSWITCH.
- Repeat the process for 1001.xml file, and get another machine to make internal calls between the internal extensions!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
In FreeSWITCH Tutorial 2, you've learnt how set internal extensions.
Now you'll need to get a SIP number from SIP Providers. SIP providers enables you to send and receive calls to PSTN numbers (normal landline & mobile nubers). A SIP provider will provide a number to get receive calls over the Internet.
After you get a SIP number, SIP provider will give you Login ID & Password to connect with.
You can configure these SIP numbers in [FreeSWITH Path]/conf/sip_profiles/external/ directory. There is a example.xml file to show you example options.
SIP profiles are slightly different along each SIP providers, but here is very basic sample (Save as NameofSIPTrunk.xml):
Code: |
<include> <gateway name="[Name of SIP Trunk]"> <param name="username" value="[SIP Trunk Username]"/> <param name="password" value="[SIP Trunk Password]"/> <param name="realm" value="[SIP Provider Domain]"/> <param name="proxy" value="[SIP Provider Domain]"/> <param name="register" value="true"/> </gateway> </include> |
SIP Trunk Username is usually your inbound number provided from your SIP provider but could be different. In this tutorial I'll assume its same as your SIP number.
Please refer to http://wiki.freeswitch.org/wiki/SIP_Provider_Examples for your SIP provider configurations.
You can reload these Profiles by restarting your FreeSWITCH or type "reloadxml" then "reload mod_sofia" from your FreeSWITCH console.
Now its time to check your connection status by typing sofia status from your FreeSWITCH console.
If you're successfully connected, you'll see [Name of SIP Trunk] REGED, if not, it will show you NOREG for your status.
After successufully connected to a SIP provider, now its time to create a dialplan under [FreeSWITCH Path]/conf/dialplan/public directory to set an inbound rule.
Lets create a simple dialplan XML file which will forward all of your calls to extension 1000 (Save as [SIP Username].xml):
Code: |
<extension name="Inbound-[SIP Username]"> <condition field='destination_number' expression='[SIP Number]'> <action application="transfer" data="1000 XML default"/> </condition> </extension> |
The above XML file will tell FreeSWITCH to forward all inbound calls to extension 1000.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
FreeSWITCH Configuration
Most of you may required to setup public IP address to send and receive calls over public network (Internet).
Its always good to use STUN (Simple Traversal of UDP through NATs - http://www.voip-info.org/wiki/view/STUN), which configured by default to use stun.freeswitch.org.
But some of you may want to set public IP address if they have fixed IP address for their own.
To setup public IP address for FreeSWITCH, follow the steps below:
- 1. Open /usr/local/freeswitch/vars.xml
2. Change <param name="manage-presence" value="false"/> to <param name="manage-presence" value="true"/>
3. Uncomment out <!--<param name="aggressive-nat-detection" value="true"/>--> (remove <!-- and -->)
4. Change <X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/> to <X-PRE-PROCESS cmd="set" data="external_rtp_ip=[YOUR PUBLIC IP ADDRESS]"/>
5. Change <X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/> to <X-PRE-PROCESS cmd="set" data="external_sip_ip=[YOUR PUBLIC IP ADDRESS]"/>
6. Open /usr/local/freeswitch/sip_profiles/external.xml
7. Change <param name="ext-rtp-ip" value="auto-nat"/> to <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
8. Change <param name="ext-sip-ip" value="auto-nat"/> to <param name="ext-sip-ip" value="$${external_sip_id}"/>
9. Restart FreeSWITCH or type "reload mod_sofia" from your FreeSWITCH console.
2. Port forwarding
If you want to set external rtp ip & external sip ip, you might have to setup port forwarding from your router to FreeSWITCH.
You will probably need to forward the specified ports:
Port 5060 UDP & TCP - SIP UAS Used for SIP signalling (Standard SIP Port, for default Internal Profile)
Port 5080 UDP & TCP - SIP UAS Used for SIP signalling (For default "External" Profile)
Port 16384-32768 UDP - RTP/ RTCP multimedia streaming Used for audio/video data in SIP and other protocols
No comments:
Post a Comment