Quickstart

From x164 documentation wiki
(Difference between revisions)
Jump to: navigation, search
(OpenVZ Installation)
(Updating and upgrading)
 
(310 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This document details the steps needed to get your x164 switch started.
 
This document details the steps needed to get your x164 switch started.
 
 
=Preface=
 
=Preface=
 +
The x164 softswitch is based on yate. It can be installed on the servers of the x164 customer or is hosted by x164 in the datacenter. We recommend installing the softswitch as an OpenVZ virtual machine. OpenVZ offers near-bare-metal performance. The advantages of virtualization are easy backups and 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.
  
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.
+
=Softswitch installation=
  
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.
+
==Setup Linux Host for OpenVZ==
  
=Softswitch installation=
 
==Installing a Linux distribution==
 
 
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  [http://www.debian.org/distrib/ here]. Installation guides are also available for the different supported architectures  [http://www.debian.org/releases/stable/installmanual here].  
 
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  [http://www.debian.org/distrib/ here]. Installation guides are also available for the different supported architectures  [http://www.debian.org/releases/stable/installmanual here].  
 
 
[http://8thstring.blogspot.com/2011/07/debian-squeeze-minimal-text-based.html 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.
 
[http://8thstring.blogspot.com/2011/07/debian-squeeze-minimal-text-based.html 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===
 
===Disk partitioning===
  
The recommended partition scheme is the following:
+
It is encouraged that you follow the order shown in the table.
  
{| class="wikitable" border="1"
+
{| border="1" cellpadding="2"
 
|-
 
|-
 
! Partition
 
! Partition
Line 43: Line 40:
 
| ext4
 
| ext4
 
| OpenVZ virtual machines will be installed in this partition
 
| OpenVZ virtual machines will be installed in this partition
|}
+
|} <br/>
 
+
It is encouraged that you follow the order shown in the table when partitioning.
+
  
 
===Updating and upgrading===
 
===Updating and upgrading===
  
After completing the installation you should run the following commands:
+
After installation run the following commands to ensure you have the latest version of the installed packages:
  
 
  sudo apt-get update
 
  sudo apt-get update
 
  sudo apt-get upgrade
 
  sudo apt-get upgrade
  
This ensures you have the latest version of the installed packages.
+
.
  
===SSH===
+
===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. First you need to install an implementation of SSH like OpenSSH. Type the following command:
+
If you want to work on your server from a remote client, it is recommended to use a Secure Shell (SSH) protocol. Install a SSH server:
  
 
  apt-get install openssh-server
 
  apt-get install openssh-server
  
Now you can open the terminal on your client and type the following to log in the host machine:
+
Now you can open the terminal on your workstation and type the following to log into the server:
  
  ssh [hostname]@[ipAdress]
+
  ssh root@[Server's IP Address]
  
It will ask you for the hostname's password. From now on you can continue working from your client machine. To log out simply type
+
Provide the password and continue working remotely.
 
+
logout
+
 
+
For further information on the OpenSSH project, please refer to their [http://www.openssh.com/ website].
+
  
 
===Midnight Commander===
 
===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:
+
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
 
  apt-get install mc
 +
mc
  
 
You can find more information about mc in [https://www.midnight-commander.org/]
 
You can find more information about mc in [https://www.midnight-commander.org/]
Line 82: Line 75:
 
===Webmin installation===
 
===Webmin installation===
  
It is recommended that you use [http://www.webmin.com/ Webmin] to easily configure your softswitch. First you need to run the following command to avoid dependency issues
+
It is recommended that you use [http://www.webmin.com/ 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
 
  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
+
Then you can download Webmin
  
 
  wget http://prdownloads.sourceforge.net/webadmin/webmin_1.590_all.deb
 
  wget http://prdownloads.sourceforge.net/webadmin/webmin_1.590_all.deb
Line 94: Line 88:
 
  dpkg --install webmin_1.590_all.deb
 
  dpkg --install webmin_1.590_all.deb
  
==OpenVZ Installation==
+
===OpenVZ Installation===
  
Installation for Debian systems is detailed in the [http://wiki.openvz.org/Installation_on_Debian OpenVZ website]. You can also find the instructions for other operating systems [http://wiki.openvz.org/Quick_installation here].
+
Installation for Debian systems is detailed in this [http://www.howtoforge.com/installing-and-using-openvz-on-debian-squeeze-amd64 tutorial].  
 
+
You can also refer to the OpenVZ installation guide  for [http://wiki.openvz.org/Installation_on_Debian Debian] and [http://wiki.openvz.org/Quick_installation other operating systems].
 
+
Start OpenVZ
+
 
+
/etc/init.d/vz start
+
  
 
==Softswitch template installation==
 
==Softswitch template installation==
Line 109: Line 99:
 
  wget http://www.x164.com/index.php/download-and-install
 
  wget http://www.x164.com/index.php/download-and-install
  
and create and start the softswitch container.
+
and create the softswitch container.
  
 
  vzctl create [CTID] --ostemplate nameOfTemplate  
 
  vzctl create [CTID] --ostemplate nameOfTemplate  
vzctl start [CTID]
 
[http://wiki.openvz.org/Basic_operations_in_OpenVZ_environment Here] you can find some of the basic operations needed to work with your container.
 
  
=Web Configuration of x164 Service=
+
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:
 +
 
 +
[[File:IDConf.png|center|500x500px]]
 +
 
 +
Then you can start your softswitch container:
 +
 
 +
vzctl start [CTID]
 +
 
 +
[http://wiki.openvz.org/Basic_operations_in_OpenVZ_environment Here] you can look up 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===
 +
 
 +
To access the x164 database in realtime from your softswitch you must need a secret key that we issue to you. To find your key, log into https://access.x164.com.
 +
 
 +
Go to the '''Rating''' tab and select '''Gateways''' in the '''Action''' area.
 +
 
 +
[[File:GatewaySecretKey.png|500x500px|center]]
 +
 
 +
You need to enter the key into the call routines in the softswitch. Go into the '''/usr/local/etc/yate''' folder of your installation 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.
 +
 
 +
[[File:yate-registerFileEditing.png|500x500px|center]]
 +
 
 +
===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
 +
 
 +
[[File:AddRuleLinuxFirewallMenu.png|500x500px|center]]
 +
 
 +
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:
 +
 
 +
[[File:LinuxFirewallMenu.png|500x500px|center]]
 +
 
 +
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 like [http://www.zoiper.com/ Zoiper]
 +
 
 +
[[File:FakeCall.png|200x200px|center]]
 +
 
 +
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 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.
 +
 
 +
[[File:CDRsExample1.png|500x500px|center]]
 +
 
 +
=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 to verify the system is working properly.
 +
 
 +
All the tables you have to use in the following section are listed in the 'Rating' tab of the web application, in the 'Actions' menu.
 +
 
 +
==Adding subscribers==
 +
 
 +
In this step you will create at least two dynamic or fixed IP subscribers and set a profile and a rate for both of them, so you can later make a test call from one to another. In the following tables the '''bold''' fields must be set, the remaining fields may stay empty.
 +
 
 +
===Adding a dynamic IP customer===
 +
 
 +
Adding a dynamic IP customer implies setting a password for authentication. Insert a new record in [http://wiki.x164.com/index.php/Documentation#Customers_table Customers] following this example:
 +
 
 +
{| border="1" cellpadding="2"
 +
|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, ...)''
 +
|} <br/>
 +
 
 +
===Adding a fixed IP customer===
 +
 
 +
Fixed IP customers are authenticated by their IP address. It is necessary to provide the pre and post location fields in [http://wiki.x164.com/index.php/Documentation#Customers_table Customers] to route incoming DID calls to the user.
 +
 
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(Automatically generated Id)''
 +
|-
 +
|Trusted Peer || '''11.22.33.44''' ''(Authorized IP address)''
 +
|-
 +
|Dynamic_ip || '''0''' ''(Flag for dynamic IP use)''
 +
|-
 +
|Subscriber || '''user1@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, ...)''
 +
|} <br/>
 +
 
 +
===Linking customer to a profile===
 +
 
 +
[http://wiki.x164.com/index.php/Dokumentation#Profiles_table Profiles] are used by the system to calculate the price of calls, and they are linked to the user by the 'Profile' field.
 +
 
 +
{| border="1" cellpadding="2"
 +
|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)''
 +
|} <br/>
 +
 
 +
===Linking rates to profiles===
 +
 
 +
[http://wiki.x164.com/index.php/Dokumentation#Rates_table Rates] include information used to calculate the price of a call and can be linked to several profiles by the 'Rate' field.
 +
 
 +
{| border="1" cellpadding="2"
 +
|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)''
 +
|-
 +
|Conn || ''(Optional, price of the call connection)''
 +
|-
 +
|Price || '''50''' ''(Price per minute)''
 +
|-
 +
|Conn In || ''(Optional, cost of the call setup)''
 +
|-
 +
|Price In || ''(Optional, cost 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 || '''3000''' ''(Automatically updated billed time of this rate)''
 +
|-
 +
|Ringtime_sum || '''0''' ''(Automatically updated ring time)''
 +
|-
 +
|Setuptime_sum || '''0''' ''(Automatically updated setup time)''
 +
|-
 +
|Calls_count || '''10''' ''(Automatically updated number of calls)''
 +
|- 
 +
|Success_count || '''10''' ''(Automatically updated number of connected calls)''
 +
|-
 +
|Acd_short || '''300''' ''(Automatically updated short-term average call duration)''
 +
|-
 +
|Acd_avr || '''300''' ''(Automatically updated long-term average call duration)''
 +
|} <br/>
 +
 
 +
==Adding DID subscribers==
 +
 
 +
Now that you have some customers you can make one of them a DID subscriber. First you have to create a DID profile and set up a block of DID numbers. For this example we are going to define the block as '34123xxxxxx' and link the number '34123456112' to the subscriber 'user2@domain.com'.
 +
 
 +
===Adding a DID profile===
 +
 
 +
Make a new entry in [http://wiki.x164.com/index.php/Documentation#Profiles_table Profiles]. The difference between a DID and a regular profile is in the 'Carrier' field, which in this case must be 'DIDRANGE'. 'DIDRANGE' tells the softswitch to route incoming calls to numbers within the DID number blocks only to subscribers:
 +
 
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(Automatically generated Id)''
 +
|-
 +
|Profile || '''DID_OURS''' ''(Profile name. Links the customers in the 'Customer' table)''
 +
|-
 +
|Rate || '''DID_OURS''' ''(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 || '''DIDRANGE''' ''(Role of the subscriber, in this case the caller)''
 +
|} <br/>
 +
 
 +
===Setting up a block of DID numbers in Rates table===
 +
 
 +
You have to make an entry in [http://wiki.x164.com/index.php/Documentation#Rates_table Rates]. The block of DID numbers is specified in the 'Destination' field.
 +
 
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(automatically generated Id)''
 +
|-
 +
|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)''
 +
|-
 +
|Region || ''(Optional region of this number)''
 +
|-
 +
|Description || ''(Optional description of the destination)''
 +
|-
 +
|App || '''audio''' ''(Application type)''
 +
|-
 +
|Conn || ''(Optional, price of the call connection)''
 +
|-
 +
|Price || '''0''' ''(Price per minute)''
 +
|-
 +
|Conn In || ''(Optional, cost of the call setup)''
 +
|-
 +
|Price In || ''(Optional, cost 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 || '''3000''' ''(Automatically updated billed time of this rate)''
 +
|-
 +
|Ringtime_sum || '''0''' ''(Automatically updated ring time)''
 +
|-
 +
|Setuptime_sum || '''0''' ''(Automatically updated setup time)''
 +
|-
 +
|Calls_count || '''10''' ''(Automatically updated number of calls)''
 +
|- 
 +
|Success_count || '''10''' ''(Automatically updated number of connected calls)''
 +
|-
 +
|Acd_short || '''300''' ''(Automatically updated short-term average call duration)''
 +
|-
 +
|Acd_avr || '''300''' ''(Automatically updated long-term average call duration)''
 +
|} <br/>
 +
 
 +
===Linking a DID number to a client===
 +
 
 +
Now link one of the numbers included in your DID range to one of your customers in the the [http://wiki.x164.com/index.php/Documentation#DIDclients_table DIDclients] table.
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(Automatically generated Id of reseller)''
 +
|-
 +
|DID_number || '''34123456112''' ''(Number of the client)''
 +
|-
 +
|DID_subscriber || '''user2@domain.com''' ''(Subscriber who owns number)''
 +
|} <br/>
 +
 
 +
===Make a test call===
 +
 
 +
Now that the subscribers and DID clients are included in the database, you can make a call from one customer to another. Just make sure both are registered to the x164 system through a softphone or an analog phone with an ATA. In the following image you can see an example of account configuration for registering with Zoiper:
 +
 
 +
[[File:ZoiperConf.png|300x300px|center]]
 +
 
 +
==Setting up carriers==
 +
 
 +
Now we are going to set up a carrier and send a test call from a previously defined customer to one of the carrier's numbers. Carriers are linked to profiles and rates in the same way as customers.
 +
 
 +
===Adding a carrier===
 +
 
 +
Enter the carrier's name, its location and a new profile in [http://wiki.x164.com/index.php/Documentation#Carriers_table 'Carriers']:
 +
 
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(Automatically generated ID)''
 +
|-
 +
|Carrier_name || '''carrier.com''' or '''22.33.44.55''' ''(Carrier's name used as billing party in the rate process)''
 +
|-
 +
|Profile || '''PROFCARRIER''' ''(Profile name. Links the carrier to a profile)''
 +
|-
 +
|Blocked || '''0''' ''(Blocked carrier flag)'
 +
|-
 +
|Pre_location || '''sip/sip:''' ''(Protocol used. Will be added before the called number. Write in lowercase)''
 +
|-
 +
|Post_location || '''@carrier.com''' or '''22.33.44.55''' ''(Carrier's URL or IP)
 +
|-
 +
|Line || ''(Optional section identifier from accfile.conf, this can be used instead of pre-location + post-location)''
 +
|-
 +
|Formats || ''(Optional codec formats separated by comma, g729, ulaw...)
 +
|} <br/>
 +
 
 +
===Linking the carrier to a profile===
 +
 
 +
Carrier profiles are also set in the [http://wiki.x164.com/index.php/Dokumentation#Profiles_table 'Profiles'] table. They difference with customer and DID profiles is in the 'Carrier' field:
 +
 
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(Automatically generated Id)''
 +
|-
 +
|Profile || '''PROFCARRIER''' ''(Profile name. Links the carrier in the 'Carriers' table)''
 +
|-
 +
|Rate || '''PROFCARRIER''' ''(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 || '''CARRIER''' ''(Role of the subscriber, in this case a carrier)''
 +
|} <br/>
 +
 
 +
===Linking the profile to a rate===
 +
 
 +
Finally go to [http://wiki.x164.com/index.php/Dokumentation#Rates_table 'Rates'] and make an entry defining the range of numbers that have to be sent to this carrier. In this case we arbitrarily chose the range '341234561xx'.
 +
 
 +
{| border="1" cellpadding="2"
 +
|Reseller || ''(automatically generated Id)''
 +
|-
 +
|Rate || '''PROFCARRIER''' ''(Link to profile in the 'Profiles' table)''
 +
|-
 +
|Destination || '''341234561xx''' ''(Destination numbers to this rate)''
 +
|-
 +
|Region || ''(Optional region of this number)''
 +
|-
 +
|Description || ''(Optional description of the destination)''
 +
|-
 +
|App || '''audio''' ''(Application type)''
 +
|-
 +
|Conn || ''(Optional, price of the call connection)''
 +
|-
 +
|Price || '''1''' ''(Price per minute)''
 +
|-
 +
|Conn In || ''(Optional, cost of the call setup)''
 +
|-
 +
|Price In || ''(Optional, cost 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 || '''3000''' ''(Automatically updated billed time of this rate)''
 +
|-
 +
|Ringtime_sum || '''3000''' ''(Automatically updated ring time)''
 +
|-
 +
|Setuptime_sum || '''3000''' ''(Automatically updated setup time)''
 +
|-
 +
|Calls_count || '''10''' ''(Automatically updated number of calls)''
 +
|- 
 +
|Success_count || '''10''' ''(Automatically updated number of connected calls)''
 +
|-
 +
|Acd_short || '''300''' ''(Automatically updated short-term average call duration)''
 +
|-
 +
|Acd_avr || '''300''' ''(Automatically updated long-term average call duration)''
 +
|} <br/>
 +
 
 +
===Make a test call to the carrier===
 +
 
 +
To ensure everything has been set up properly, make a call from one of your customers to a carrier's number and verify the call is properly sent.

Latest revision as of 08:43, 10 October 2019

This document details the steps needed to get your x164 switch started.

Contents

[edit] Preface

The x164 softswitch is based on yate. It can be installed on the servers of the x164 customer or is hosted by x164 in the datacenter. We recommend installing the softswitch as an OpenVZ virtual machine. OpenVZ offers near-bare-metal performance. The advantages of virtualization are easy backups and 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.

[edit] Softswitch installation

[edit] 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.

[edit] Disk partitioning

It is encouraged that you follow the order shown in the table.

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

[edit] Updating and upgrading

After installation run the following commands to ensure you have the latest version of the installed packages:

sudo apt-get update
sudo apt-get upgrade

.

[edit] Remote SSH access

If you want to work on your server 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 into the server:

ssh root@[Server's IP Address]

Provide the password and continue working remotely.

[edit] 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]

[edit] 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

[edit] 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.

[edit] 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:

IDConf.png

Then you can start your softswitch container:

vzctl start [CTID]

Here you can look up some of the basic operations needed to work with your container.

[edit] 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.

[edit] Editing register.conf file

To access the x164 database in realtime from your softswitch you must need a secret key that we issue to you. To find your key, log into https://access.x164.com.

Go to the Rating tab and select Gateways in the Action area.

GatewaySecretKey.png

You need to enter the key into the call routines in the softswitch. Go into the /usr/local/etc/yate folder of your installation 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.

Yate-registerFileEditing.png

[edit] 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

AddRuleLinuxFirewallMenu.png

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:

LinuxFirewallMenu.png

Press the Apply button to activate the rules.

[edit] 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 like Zoiper

FakeCall.png

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.

[edit] 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.

CDRsExample1.png

[edit] 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 to verify the system is working properly.

All the tables you have to use in the following section are listed in the 'Rating' tab of the web application, in the 'Actions' menu.

[edit] Adding subscribers

In this step you will create at least two dynamic or fixed IP subscribers and set a profile and a rate for both of them, so you can later make a test call from one to another. In the following tables the bold fields must be set, the remaining fields may stay empty.

[edit] Adding a dynamic IP customer

Adding a dynamic IP customer implies setting a password for authentication. Insert a new record in Customers following this example:

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, ...)

[edit] Adding a fixed IP customer

Fixed IP customers are authenticated by their IP address. It is necessary to provide the pre and post location fields in Customers to route incoming DID calls to the user.

Reseller (Automatically generated Id)
Trusted Peer 11.22.33.44 (Authorized IP address)
Dynamic_ip 0 (Flag for dynamic IP use)
Subscriber user1@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, ...)

[edit] Linking customer to a profile

Profiles are used by the system to calculate the price of calls, and they are linked to the user by the 'Profile' field.

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)

[edit] Linking rates to profiles

Rates include information used to calculate the price of a call and can be linked to several profiles by the 'Rate' field.

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)
Conn (Optional, price of the call connection)
Price 50 (Price per minute)
Conn In (Optional, cost of the call setup)
Price In (Optional, cost 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 3000 (Automatically updated billed time of this rate)
Ringtime_sum 0 (Automatically updated ring time)
Setuptime_sum 0 (Automatically updated setup time)
Calls_count 10 (Automatically updated number of calls)
Success_count 10 (Automatically updated number of connected calls)
Acd_short 300 (Automatically updated short-term average call duration)
Acd_avr 300 (Automatically updated long-term average call duration)

[edit] Adding DID subscribers

Now that you have some customers you can make one of them a DID subscriber. First you have to create a DID profile and set up a block of DID numbers. For this example we are going to define the block as '34123xxxxxx' and link the number '34123456112' to the subscriber 'user2@domain.com'.

[edit] Adding a DID profile

Make a new entry in Profiles. The difference between a DID and a regular profile is in the 'Carrier' field, which in this case must be 'DIDRANGE'. 'DIDRANGE' tells the softswitch to route incoming calls to numbers within the DID number blocks only to subscribers:

Reseller (Automatically generated Id)
Profile DID_OURS (Profile name. Links the customers in the 'Customer' table)
Rate DID_OURS (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 DIDRANGE (Role of the subscriber, in this case the caller)

[edit] Setting up a block of DID numbers in Rates table

You have to make an entry in Rates. The block of DID numbers is specified in the 'Destination' field.

Reseller (automatically generated Id)
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)
Region (Optional region of this number)
Description (Optional description of the destination)
App audio (Application type)
Conn (Optional, price of the call connection)
Price 0 (Price per minute)
Conn In (Optional, cost of the call setup)
Price In (Optional, cost 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 3000 (Automatically updated billed time of this rate)
Ringtime_sum 0 (Automatically updated ring time)
Setuptime_sum 0 (Automatically updated setup time)
Calls_count 10 (Automatically updated number of calls)
Success_count 10 (Automatically updated number of connected calls)
Acd_short 300 (Automatically updated short-term average call duration)
Acd_avr 300 (Automatically updated long-term average call duration)

[edit] Linking a DID number to a client

Now link one of the numbers included in your DID range to one of your customers in the the DIDclients table.

Reseller (Automatically generated Id of reseller)
DID_number 34123456112 (Number of the client)
DID_subscriber user2@domain.com (Subscriber who owns number)

[edit] Make a test call

Now that the subscribers and DID clients are included in the database, you can make a call from one customer to another. Just make sure both are registered to the x164 system through a softphone or an analog phone with an ATA. In the following image you can see an example of account configuration for registering with Zoiper:

ZoiperConf.png

[edit] Setting up carriers

Now we are going to set up a carrier and send a test call from a previously defined customer to one of the carrier's numbers. Carriers are linked to profiles and rates in the same way as customers.

[edit] Adding a carrier

Enter the carrier's name, its location and a new profile in 'Carriers':

Reseller (Automatically generated ID)
Carrier_name carrier.com or 22.33.44.55 (Carrier's name used as billing party in the rate process)
Profile PROFCARRIER (Profile name. Links the carrier to a profile)
Blocked 0 (Blocked carrier flag)'
Pre_location sip/sip: (Protocol used. Will be added before the called number. Write in lowercase)
Post_location @carrier.com or 22.33.44.55 (Carrier's URL or IP)
Line (Optional section identifier from accfile.conf, this can be used instead of pre-location + post-location)
Formats (Optional codec formats separated by comma, g729, ulaw...)

[edit] Linking the carrier to a profile

Carrier profiles are also set in the 'Profiles' table. They difference with customer and DID profiles is in the 'Carrier' field:

Reseller (Automatically generated Id)
Profile PROFCARRIER (Profile name. Links the carrier in the 'Carriers' table)
Rate PROFCARRIER (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 CARRIER (Role of the subscriber, in this case a carrier)

[edit] Linking the profile to a rate

Finally go to 'Rates' and make an entry defining the range of numbers that have to be sent to this carrier. In this case we arbitrarily chose the range '341234561xx'.

Reseller (automatically generated Id)
Rate PROFCARRIER (Link to profile in the 'Profiles' table)
Destination 341234561xx (Destination numbers to this rate)
Region (Optional region of this number)
Description (Optional description of the destination)
App audio (Application type)
Conn (Optional, price of the call connection)
Price 1 (Price per minute)
Conn In (Optional, cost of the call setup)
Price In (Optional, cost 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 3000 (Automatically updated billed time of this rate)
Ringtime_sum 3000 (Automatically updated ring time)
Setuptime_sum 3000 (Automatically updated setup time)
Calls_count 10 (Automatically updated number of calls)
Success_count 10 (Automatically updated number of connected calls)
Acd_short 300 (Automatically updated short-term average call duration)
Acd_avr 300 (Automatically updated long-term average call duration)

[edit] Make a test call to the carrier

To ensure everything has been set up properly, make a call from one of your customers to a carrier's number and verify the call is properly sent.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox