Quickstart
(→Linking customer to a profile) |
(→Linking customer to a profile) |
||
Line 230: | Line 230: | ||
===Linking customer to a profile=== | ===Linking customer to a profile=== | ||
− | + | Next step is adding a profile, which is used by the system to calculate the price of calls. The 'Profile' field of a customer entry determines the profile it is linked to. Select [http://wiki.x164.com/index.php/Dokumentation#Profiles_table 'Profiles'] in the 'Action' area and add a new one: | |
{| border="1" cellpadding="2" | {| border="1" cellpadding="2" |
Revision as of 13:28, 12 September 2012
This document details the steps needed to get your x164 switch started.
Contents |
Preface
The x164 softswitch is based on yate. The softswitch can be installed on the servers of the x164 customer or is hosted by x164 in the datacenter.
We recommend to install the softswitch as a OpenVZ virtual machine. OpenVZ offers near-bare-metal performance. The advantage of virtualization are: Easy backups, easy migration to different hardware in case of failures or hardware upgrades. x164 provides a OpenVZ template for download which is a ready-configured softswitch.
Softswitch installation
Setup Linux Host for OpenVZ
Use of Debian Squeeze is recommended for its stability, but you can use other Linux distributions as you wish. You can look for the proper option for your machine here. Installation guides are also available for the different supported architectures here.
This website offers a screenshot based tutorial that explains how to make a bare-bones installation without a graphical desktop environment. We suggest to create a separate partition /vz to store the virtual machines, as for example in the following scheme.
Disk partitioning
The recommended partition scheme is the following:
Partition | Size | File system | Comments |
---|---|---|---|
/boot | 500 MB | ext2 | |
swap | ~ | swap | Size should be the same as RAM |
/ | 20 GB | ext4 | |
/vz | remaining disk space | ext4 | OpenVZ virtual machines will be installed in this partition |
It is encouraged that you follow the order shown in the table when partitioning.
Updating and upgrading
After completing the installation you should run the following commands:
sudo apt-get update sudo apt-get upgrade
This ensures you have the latest version of the installed packages.
Remote SSH access
If you want to work on your server remotely from a remote client, it is recommended to use a Secure Shell (SSH) protocol. Install a SSH server:
apt-get install openssh-server
Now you can open the terminal on your workstation and type the following to log in the host machine:
ssh root@[ipAdress]
It will ask you for the hostname's password. From now on you can continue working from your workstation remotely.
Midnight Commander
We recommend using a visual file manager like Midnight Commander (mc) to make working with the command line easier. To install it in your server enter this command:
apt-get install mc mc
You can find more information about mc in [1]
Webmin installation
It is recommended that you use Webmin to easily configure your softswitch. Run the following command to avoid dependency issues
apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
Then you can download Webmin
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.590_all.deb
and install it
dpkg --install webmin_1.590_all.deb
OpenVZ Installation
Installation for Debian systems is detailed in this tutorial. You can also refer to the OpenVZ installation guide for Debian and other operating systems.
Softswitch template installation
To download the softswitch template just run the following command:
wget http://www.x164.com/index.php/download-and-install
and create the softswitch container.
vzctl create [CTID] --ostemplate nameOfTemplate
Once you have created a new [CTID].conf file will appear at /etc/vz/conf. There you can set the VM's IP, gateway and hostname as it fits your network, among other parameters. This is an example of what the .conf file should look like:
Then you can start your softswitch container:
vzctl start [CTID]
Here you can find some of the basic operations needed to work with your container.
Setup softswitch to connect with x164
The softswitch needs to connect to the x164 database to retrieve routing information and to the x164 radius server to send call details records. We will initiate fake calls from a softphone to test whether everything works correctly.
Editing register.conf file
Go into the /usr/local/etc/yate folder of your virtual machine and open the register.conf file. In this file the string 'hyTnw94^^f' must be substituted by your own secret key for MySQL procedures in yate.
To find your key, log into https://access.x164.com. Go to the Rating tab and select Gateways in the Action area.
Setup Firewall on Softswitch
The firewall can be setup comfortably with Webmin:
https://softswitchIP:10000
In the Networking/Linux Firewall subsection, Default Action should be set to Drop. Then a new rule must by added by clicking Add Rule. This new rule must be defined like this
where 11.22.33.55 is the IP of your workstation. The firewall must be opened for all IPs from which you receive VoIP traffic. Now the Linux Firewall menu should look like this:
Press the Apply button to activate the rules.
Verify yate functionality
You can verify that yate is working in principle. Go to the terminal and log into the softswitch through port 29. Using a port which is not the standard ssh port 22 reduces the chance that some weak password is hacked.
ssh root@[softswitchIP]:29
Then see what is happening on the port that will receive the fake call. The softswitch listens on udp port 5061 and not the standard port 5060.
usr/local/etc/yate ngrep port 5061
Now you can attempt a call from a softphone Zoiper
After dialing you should see SIP messages going back and forth between the soft phone and yate. As no subscriber is setup in the system the call will of course fail.
Connection to Radius server
Login into https://access.x164.com and click search in the CDRs tab. The test calls your did should be shown, confirming that the softswitch is connected to the x164 radius server.
Web Configuration of the x164 Service
To get the x164 system started, you must create some new subscribers and set up a block of DID numbers. Once you have done this you can make a test call and verify the system is working properly.
Adding subscribers
We are going to create dynamic and a fixed IP subscribers and set a profile and a rate for both of them. In the following tables the bold fields must be set, the remaining fields may stay empty.
Adding a dynamic IP customer
To see your customers table go to the 'Rating' tab and select 'Customers' in the 'Action' field. This is the example you should follow when they have a dynamic IP address:
Reseller | (Automatically generated Id) |
Dynamic_ip | 1 (Flag for dynamic IP use) |
Subscriber | user1@domain.com (Subscriber name) |
Password | verysecret (User password) |
Profile | PROFCLIENT (Profile name. Links the customer to a profile in the 'Profiles' table) |
Blocked | 0 (Block subscriber flag) |
Pre_location | sip/sip: (Protocol used. Will be added before the called number. Write in lowercase) |
Post_location | (Automatically updated IP address after SIP client registers to softswitch) |
Expires | (Automatically updated when dynamic IP expires) |
Formats | (Optional codec formats separated by comma, g729, ulaw, ...) |
Adding a fixed IP customer
For fixed IP customers authentication is based on their IP address, so there is no need to provide a password. Also it's necessary to provide the post location field so their calls can be routed by the x164 system.
Reseller | (Automatically generated Id) |
Trusted Peer | 11.22.33.44 (Authorized IP address) |
Dynamic_ip | 0 (Flag for dynamic IP use) |
Subscriber | user2@domain.com (Subscriber name) |
Profile | PROFCLIENT (Profile name. Links the customer to a profile in the 'Profiles' table) |
Subscriber_out | (In case subscriber provides also termination his carrier name must be set to avoid looping calls) |
Blocked | 0 (Blocked subscriber flag) |
Pre_location | sip/sip: (Protocol used. Will be added before the called number. Write in lowercase) |
Post_location | @11.22.33.44 (Customer's IP address) |
Formats | (Optional codec formats separated by comma, g729, ulaw, ...) |
Linking customer to a profile
Next step is adding a profile, which is used by the system to calculate the price of calls. The 'Profile' field of a customer entry determines the profile it is linked to. Select 'Profiles' in the 'Action' area and add a new one:
Reseller | (Automatically generated Id) |
Profile | PROFCLIENT (Profile name. Links the customers in the 'Customer' table) |
Rate | PROFCLIENT (Link to profile's rates in the 'Rates' table) |
Starthourweek | 0 (Start hour in the week of this tariff) |
Endhourweek | 167 (End hour in the week of this tariff) |
Penalty | (Optional price added to this tariff) |
Timezone | GMT (Timezone, reflects the local time of the tariff) |
Incr | 1 (Used to consider the duration of the call in increments) |
Min_Dur | 1 (Minimum duration of the call) |
Curr_code | EUR (Currency used in iso format) |
Carrier | IN (Role of the subscriber, in this case the caller) |
Linking rates to profiles
Rates include information used to calculate the price of a call. A rate can apply to several profiles. Go to 'Rates' in the 'Action' area and insert a new rate:
Reseller | (automatically generated Id) |
Rate | PROFCLIENT (Link to profile in the 'Profiles' table) |
Destination | 34123 (Destination number to this rate) |
Region | (Optional region of this number) |
Description | (Optional description of the destination) |
App | audio (Application type) |
Price | 1 (Price per minute) |
Start Date | 2008-01-01 (Start time of the rate) |
End Date | 2022-01-01 (End time of the rate) |
Blocked | 0 (Blocked rate flag) |
Billtime_sum | (Automatically updated billed time of this rate) |
Ringtime_sum | (Automatically updated ring time) |
Setuptime_sum | (Automatically updated setup time) |
Calls_count | (Automatically updated number of calls) |
Success_count | (Automatically updated number of connected calls) |
Acd_short | (Automatically updated short-term average call duration) |
Acd_avr | (Automatically updated long-term average call duration) |
Adding a DID subscriber
We are going to create a DID subscriber for a range of own numbers.
Adding a DID profile
Follow the previous explanation for linking a customer to a profile, only changing this fields:
Profile | DID_OURS (Profile name. Links the customers in the 'Customer' table) |
Rate | DID_OURS (Link to profile's rates in the 'Rates' table) |
Carrier | DIDRANGE (Role of the subscriber. DIDRANGE is needed to define the range of your own numbers) |
Setting up block of DID numbers
Follow the previous explanation for linking rates to profiles, and change this fields:
Rate | DID_OURS (Link to profile in the 'Profiles' table) |
Destination | 34123 (Destination number to this rate. In this case this is the range of own numbers) |
Price | 0 (Price per minute) |
Linking a DID to a client
Go to 'DIDclients' in the 'Action' area:
Reseller | (Automatically generated Id of reseller) |
DID_number | 34123456113 (Number of the client) |
DID_subscriber | user3@domain.com (Subscriber who owns number) |
Make a test call
Create an account for one of your customers in a softphone and verify it registers :
Attest your DID client is also registered. Then you can make a call from the softphone to your own number.