Documentation

From x164 documentation wiki
(Difference between revisions)
Jump to: navigation, search
(x164 Call flow)
(x164 Introduction)
 
(122 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
== x164 Introduction ==
 
== x164 Introduction ==
  
x164 consists of a central database which holds private and public rate tables, statistics and route configurations. Many x164 switches connect to the central x164 database to retrieve routing information and to update the statistics in realtime. Softswitches are preferably, but not limited to, [http://yate.null.ro yate-based] switches. Call detail records are collected with radius. Call details, statistics and the configuration screens are accessible by the [https://access.x164.com web access].
+
x164 consists of SBC softswitches which are installed as virtual machines at local customer premises or in the cloud. SBC softswitches are managed online in the x164 management platform which holds rate tables, statistics and route configurations. The management system collects statistical information in realtime so that routes can be optimized continuously. Call detail records are collected in a radius database and are rated in the CDR module. The management of x164 happens online.
  
[[File:X164system.png|center|900x900px]]
+
[[File:Routing.png|center|900x900px]]
  
==x164 database==
+
== Features ==
  
In addition to storing the rates information, the x164 database is used to perform several tasks, for example authenticating users, setting up credit limits, and blocking bad routes. Ip addresses for switches are set in the [http://wiki.x164.com/index.php/Documentation#Gateways_table Gateways] table. [http://wiki.x164.com/index.php/Documentation#Carriers_table Carriers] and [http://wiki.x164.com/index.php/Documentation#Customers_table Customers] are defined separately in their own tables, and are linked to a profile in [http://wiki.x164.com/index.php/Documentation#Profiles_table Profiles], which in turn is attached to a set of rates in the [http://wiki.x164.com/index.php/Documentation#Rates_table Rates] table. A profile can be of type 'IN' (links customers to incoming rates), 'CARRIER' (links carriers to outgoing rates ), or 'DIDRANGE' (routes that terminate in your own network). DID numbers are defined in [http://wiki.x164.com/index.php/Documentation#DIDclients_table DIDcients]. The table relationship is as follows:
+
Management
 +
 
 +
* Cloud based management Web-interface
 +
* Administration of multiple SBC with one interface
 +
* Reseller functionality
 +
* User and permissions management
 +
* Monitoring of active sessions and call history
 +
* Statistics and call rating on completed sessions
 +
 
 +
Security
 +
 
 +
* The SBC is a B2BUA which separates the call legs hiding the network topology
 +
* TLS and SRTP
 +
* Firewall, IP Black lists, IP White lists
 +
* Enforce expenditure limits so excessive traffic from certain nodes is automatically blocked.
 +
* Load balancing, unlimited number of SBC, clustered databases
 +
 
 +
Routing

 +
 
 +
* Routing between unlimited number of nodes, domains, switches
 +
* Time-based Routing
 +
* Routing based on destination number, source number and redirecting number
 +
* Routing / blocking of calls based on profit parameters, block unprofitable calls
 +
* Routing based on prefix, extension ranges
 +
* Number porting, number translation
 +
* Manipulation of destination number, source number
 +
* Manipulation before, during and after routing
 +
* Failover routes
 +
* Least-cost-routing
 +
 
 +
Transport protocols
 +
 
 +
* IPv4, IPv6
 +
* UDP, TCP, TLS
 +
* NAT
 +
 
 +
Signaling
 +
 
 +
* SIP
 +
* H.323
 +
 
 +
Media
 +
 
 +
* RTP / SRTP
 +
* Media Pass-through, Media Transcoding, Media Bypass
 +
* Codecs G.711 a-law, u-law, gsm, libc10, ilbs, amr, slin, g723,g726,g728,G.729
 +
* T.38 Fax
 +
 
 +
 
 +
== Database ==
 +
 
 +
The x164 database stores CDRs, rating tables, route statistics and client information. From the web access you can easily manage the database and perform several tasks such as uploading rate tables, setting up credit limits for customers, and blocking bad routes.
 +
 
 +
[http://wiki.x164.com/index.php/Documentation#Carriers_table Carriers] and [http://wiki.x164.com/index.php/Documentation#Customers_table Customers] are defined separately in their own tables, and they are linked to a profile in [http://wiki.x164.com/index.php/Documentation#Profiles_table Profiles], which in turn is attached to a set of rates in the [http://wiki.x164.com/index.php/Documentation#Rates_table Rates] table. A profile can be of type 'IN' (links customers to incoming rates), 'CARRIER' (links carriers to outgoing rates ), or 'DIDRANGE' (routes that terminate in your own network). DID numbers are defined in [http://wiki.x164.com/index.php/Documentation#DIDclients_table DIDcients]. The table relationship is as follows:
  
  
 
[[File:TableRelationship.png|500x500px|center]]
 
[[File:TableRelationship.png|500x500px|center]]
  
It is possible to allow the user to choose dynamically between different rate sets by using prefix dialing. This is accomplished by creating many instances of the same incoming profile and setting a different rate name and prefix for each one of them. Rates associated with this profiles will only be available when dialing the prefix.
+
It is possible to allow the user to choose dynamically between different rate sets by using prefix dialing. This is accomplished by creating many instances of the same incoming profile and setting a different rate name and prefix for each one of them. Rates associated with this profiles will only be available when dialing the prefix. A more detailed explanation can be found [http://wiki.x164.com/index.php/Howto#How_can_I_set_up_customer_profiles_with_prefix_dialing.3F here].
  
[http://wiki.x164.com/index.php/Documentation#Currencies_table Currencies] sets the exchange rate to euros for each currency. When looking up routes, the field 'curr_code' in Profiles links to the matching exchange rate and the price for routes is normalized according to it.
+
[http://wiki.x164.com/index.php/Documentation#Currencies_table Currencies] sets the exchange rate to euros for each currency. When looking up routes, the field 'curr_code' in Profiles links to the matching exchange rate, and the price for routes is normalized according to it.
  
Finally, monthly credit limits for subscribers can be set in the [http://wiki.x164.com/index.php/Documentation#Quota_table Quota] table. This table keeps record of the monthly bill sum for each subscriber. Ia quata is set and the limit is reached, the subscriber is blocked. This means the field 'blocked' of its entry in the Customers or Carriers table is set to 1. Unblocking must be done manually.
+
Finally, monthly credit limits for subscribers can be set in the [http://wiki.x164.com/index.php/Documentation#Quota_table Quota] table. This table keeps record of the monthly bill sum for each subscriber. If a quota is set and the limit is reached, the subscriber is blocked. This means the field 'blocked' of its entry in the Customers or Carriers table is set to 1. Unblocking must be done manually.
  
==x164 Call flow==
+
==Call flow==
  
When receiving a call, the softswitch queries the database for user authentication using the [http://wiki.x164.com/index.php/Documentation#Authuser Authuser] procedure. The flag 'Dynamic_IP' in Customers indicates if the customer uses fixed or dynamic IP. In the first case, authentication is made by IP. In the second, the fields 'Subscriber' and 'Password' are used.  
+
When receiving a call, the softswitch queries the database for user authentication using the [http://wiki.x164.com/index.php/Documentation#Authuser Authuser] procedure. The flag 'Dynamic_IP' in [http://wiki.x164.com/index.php/Documentation#Customers_table Customers] indicates if the customer uses fixed or dynamic IP. In the first case, authentication is made by IP. In the second, the fields 'Subscriber' and 'Password' are used.  
  
 
If the authentication is positive, the softswith calls the [http://wiki.x164.com/index.php/Documentation#Preroute Preroute] procedure to check that the user is allowed to call the dialed number. The user's profile is linked to a set of rates that define the allowed destinations. If there is a match between the called number and one of this rates, the softswitch looks up the database for outgoing rates.  
 
If the authentication is positive, the softswith calls the [http://wiki.x164.com/index.php/Documentation#Preroute Preroute] procedure to check that the user is allowed to call the dialed number. The user's profile is linked to a set of rates that define the allowed destinations. If there is a match between the called number and one of this rates, the softswitch looks up the database for outgoing rates.  
  
Outgoing rates are retrieved with the [http://wiki.x164.com/index.php/Documentation#Route Route] procedure. �The algorithm takes the longest code match for each company and measures the expected profit taking in account the incoming rate, the outgoing rate and the route's quality statistics available in the Rates table. If no matched rate is profitable, the call is blocked. Otherwise, the most profitable rate is picked and the call is routed. At the end of the call the CDR database and the route's statistics are updated.
+
Outgoing rates are retrieved with the [http://wiki.x164.com/index.php/Documentation#Route Route] procedure.  
 +
The algorithm retrieves the rates with the longest code match for each carrier, and calculates their profitability. Only rates that generate revenue are returned. The softswitch attempts to route the call using this rates, starting from the most to the least profitable until the call is effectively routed.
 +
 
 +
When the call finishes, a CDR is created and the rate's statistics are updated with the [http://wiki.x164.com/index.php/Documentation#cdr_finalize cdr_finalize] procedure.
  
 
<div align=center> [[File:CallFlow.png|450x450px]] [[File:X164scheme.png|500x500px]] </div>
 
<div align=center> [[File:CallFlow.png|450x450px]] [[File:X164scheme.png|500x500px]] </div>
Line 37: Line 93:
 
=== Call search menu ===
 
=== Call search menu ===
  
==== Description ====
+
The call search offers access to Call Detail Records (CDRs). CDRs can be summarized and filtered for various statistics.
The call search offers access to call-detail-records (CDRs). CDRs can be summarized and filtered for various statistics.
+
  
==== Selection fields ====
 
 
{|border="1" cellpadding="2"
 
{|border="1" cellpadding="2"
 
|Data source || Database where are the call details
 
|Data source || Database where are the call details
Line 48: Line 102:
 
|Stop time || End of the range of time in search
 
|Stop time || End of the range of time in search
 
|-
 
|-
|Sip call / Sip source || Filter by the user ID, received from the customer or proxy
+
|Sip call / Sip source || Filter by user ID, received from the customer or proxy
 
|-
 
|-
 
|User agents / Media code || Filter by the format of the call
 
|User agents / Media code || Filter by the format of the call
Line 60: Line 114:
 
|Duration / Application / status || Filter selecting different call duration, media or the status of the call
 
|Duration / Application / status || Filter selecting different call duration, media or the status of the call
 
|-
 
|-
|Order by / Group by || Complements the search ordering results, change the limit of records to show, grouping these and if ReNormalize is marked the system recalculate the call prices
+
|Order by / Group by || Complements the search ordering results, change the limit of records to show, grouping these and if ReNormalize is marked the system recalculates the call prices
 
|} <br/>
 
|} <br/>
  
Line 66: Line 120:
  
 
Access to all data influencing the rating and routing. The rating data is contained in several tables which can be selected on the top-right side.
 
Access to all data influencing the rating and routing. The rating data is contained in several tables which can be selected on the top-right side.
The cost calculation of the calls stored in the system occurs in parallel and periodically using the values that the user introduce ​​in this tables.
+
The cost calculation of the calls stored in the system occurs in parallel and periodically using the values that the user introduces ​​in this tables.
  
 
==== Customers table ====
 
==== Customers table ====
  
===== Description =====
+
The Customers table shows details of your authorized users who may send calls through the x164 system. Customers can be authorized by Trusted Peer when they use fixed IP or Subscriber and Password for dynamic IP users.
  
The Customers table shows details of your authorized customers who may send calls through the x164 system. The user can be authorized by trusted peer or subscriber and password.
+
Customers are linked to incoming profiles via the Profile field. In turn, this profiles link to a set of incoming rates that determine the destinations that the customer is allowed to call.
 +
 
 +
When a customer number is within a DID block, the Subscriber field links to an entry in the DIDclients table that defines the user's number. This field is also used to set up quota limits for customers in the Quota Usage table.
  
===== Data fields =====
 
 
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-
 
|-
|Reseller || Numeric ID of reseller  
+
|Reseller || ID string of reseller
 
|-
 
|-
|Trusted Peer || Authorized IP address, in this case the user is authorized by IP  
+
|Trusted Peer || Authorized IP address, in case the user is authorized by IP (Dynamic_IP = 0)
 
|-
 
|-
 
|Domain || Not used
 
|Domain || Not used
Line 91: Line 145:
 
|Password || Password for authorized users
 
|Password || Password for authorized users
 
|-
 
|-
|Profile || Profile name which links the customer to a profile in the profile table  
+
|Profile || Profile name which links the customer to a profile in the Profiles table  
 
|-
 
|-
|Subscriber_out || In case subscriber also provides outgoing routes put outgoing subscriber name here to avoid looping calls
+
|Subscriber_out || In case the subscriber also provides outgoing routes, put outgoing subscriber name here to avoid looping calls
 
|-
 
|-
|Blocked || Block the subscriber when value set to 1
+
|Blocked || Blocks the subscriber when is set to 1
 
|-
 
|-
|Pre_location || Parameters that are added before the called number in the outgoing message (possible values: SIP/00 to identify a SIP carrier with prefix of 00 in front of the e164 number)
+
|Pre_location || Parameters that are added before the called number in the outgoing message (sip/sip:) (possible values: sip/00 to identify a SIP carrier with prefix of 00 in front of the e164 number)
 
|-
 
|-
 
|Post_location || URL and parameters added to the called number in the outgoing message, e.g. @carrier.com
 
|Post_location || URL and parameters added to the called number in the outgoing message, e.g. @carrier.com
 
|-
 
|-
| || The outgoing route is defined as: pre-location + e164 number + post-location, e.g. SIP/004930123456789@carrier.com
+
| || The outgoing route is defined as: pre-location + e164 number + post-location, e.g. sip/sip:4930123456789@carrier.com
 
|-
 
|-
 
|Expires || Expiration time of the dynamic IP
 
|Expires || Expiration time of the dynamic IP
Line 108: Line 162:
 
|Formats || Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)  
 
|Formats || Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)  
 
|-
 
|-
|rtpProxy || 1 activates rtp proxying for this route
+
|rtpProxy || 1 activates RTP proxying for this route
 
|} <br/>
 
|} <br/>
  
 
==== Carriers table ====
 
==== Carriers table ====
  
===== Description =====
+
The Carriers table has the details of your carriers to send calls to them. A carrier has an unique 'CARRIER' profile, which is attached to its available outgoing rates. Carrier_name can be used to set a quota limit in the Quota usage table.
  
The Carriers table has the details of your carriers to send calls to them.
 
 
===== Data fields =====
 
 
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-
 
|-
|Reseller || Numeric ID of reseller  
+
|Reseller || ID string of reseller
 
|-
 
|-
 
|Domain || Not used
 
|Domain || Not used
Line 132: Line 182:
 
|Blocked || Block the subscriber when value set to 1
 
|Blocked || Block the subscriber when value set to 1
 
|-
 
|-
|Pre_location || Parameters that are added before the called number in the outgoing message (possible values: SIP/00 to identify a SIP carrier with prefix of 00 in front of the e164 number)
+
|Pre_location || Parameters that are added before the called number in the outgoing message (sip/sip:)(possible values: SIP/00 to identify a SIP carrier with prefix of 00 in front of the e164 number)
 
|-
 
|-
 
|Post_location || URL and parameters added to the called number in the outgoing message, e.g. @carrier.com
 
|Post_location || URL and parameters added to the called number in the outgoing message, e.g. @carrier.com
 
|-
 
|-
| || The outgoing route is defined as: pre-location + e164 number + post-location, e.g. SIP/004930123456789@carrier.com
+
| || The outgoing route is defined as: pre-location + e164 number + post-location, e.g. sip/sip:4930123456789@carrier.com
 
|-
 
|-
 
|Line || Section identifier from accfile.conf, this can be used instead of pre-location, post-location
 
|Line || Section identifier from accfile.conf, this can be used instead of pre-location, post-location
Line 148: Line 198:
 
==== Profiles table ====
 
==== Profiles table ====
  
===== Description =====
+
The Profiles table links customers, carriers and DID blocks to their respective rates. It also sets rate plan details such as valid week hours, minimum charged price, and currency in which the rates are expressed.
 +
 
 +
There are three type of profiles: 'IN', 'CARRIER' and 'DIDRANGE'. 'IN' profiles link customers with incoming rates. The field Tech_prefix is used in 'IN' profiles to enable prefix dialing, as explained [http://wiki.x164.com/index.php/Howto#How_can_I_set_up_customer_profiles_with_prefix_dialing.3F here].
  
The profiles table shows the rate details assigned to customers which will be used to calculate the price of the call by x164 system,
+
'CARRIER' profiles link carriers with outgoing routes. A carrier may have several rate plans and different time frames and penalties can be set for each of them.
  
===== Data fields =====
+
'DIDRANGE' is used to define blocks of own numbers. The range is defined in the Rates table, and customers with numbers within this range are set in the DIDclients table.
  
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-  
 
|-  
|Reseller || Numeric ID of reseller  
+
|Reseller || ID string of reseller
 
|-
 
|-
|Profile || Profile name which links the customer to the profile table  
+
|Profile || Profile name which links the customer or carrier to the profile table  
 
|-
 
|-
|Rate || Rate name which identifies the rates used for this profile in the rates table
+
|Rate || Rate name which identifies the rates used for this profile in the Rates table
 
|-  
 
|-  
 
|Starthourweek || Start hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
 
|Starthourweek || Start hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
Line 187: Line 239:
 
==== Rates table ====
 
==== Rates table ====
  
===== Description =====
+
The Rates table contains the rate information used by x164 to pick routes and calculate tariffs. Statistics for call duration and success rate are stored here and updated in real time every time a rate is used.
  
The rate table shows details to calculate the price by x164 system according to valid tariff and destination
+
All prices must be defined as the original price multiplied by ten thousand. For example, for a rate of 0.1234 Euros, the input price in the x164 system should be 1234.
  
===== Data fields =====
 
 
{| border="1" cellpadding="2" width=1000
 
{| border="1" cellpadding="2" width=1000
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-  
 
|-  
|Reseller || ID number
+
|Reseller || ID string of reseller
 
|-  
 
|-  
 
|Rate || ID of the rate
 
|Rate || ID of the rate
Line 235: Line 286:
 
|Acd_avr || Long-term average call duration, updated after each call  with acd_avr = (acd_short + (billtime_sum / success_count)) / 2
 
|Acd_avr || Long-term average call duration, updated after each call  with acd_avr = (acd_short + (billtime_sum / success_count)) / 2
 
|} <br/>
 
|} <br/>
 +
 
==== Gateways table ====
 
==== Gateways table ====
  
===== Description =====
+
The gateways table serves to identify the IP addresses of the switches used by the reseller.
 
+
The gateways table serves to identify the IP address of the switches used by the reseller.
+
 
+
===== Data fields =====
+
 
   
 
   
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-
 
|-
|Reseller || ID number
+
|Reseller || ID string of reseller
 
|-
 
|-
 
|Gateway || IP address of the switch
 
|Gateway || IP address of the switch
Line 255: Line 303:
 
==== DIDclients table ====
 
==== DIDclients table ====
  
===== Description =====
+
DIDclients is used to associate a DID number with a subscriber. When a call is being routed and the retrieved rate is attached to a 'DIDRANGE' profile, the system refers to this table to identify the subscriber who owns the number. See how to set up a DID subscriber [http://wiki.x164.com/index.php/Quickstart#Adding_DID_subscribers here].
 
+
The DIDclients table shows the DID clients with their numbers.
+
 
+
===== Data fields =====
+
 
   
 
   
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-
 
|-
|Reseller || ID number
+
|Reseller || ID string of reseller
 
|-
 
|-
 
|DID_number || Number of the client
 
|DID_number || Number of the client
 
|-
 
|-
|DID_subscriber || Subscriber who belongs this number  
+
|DID_subscriber || Subscriber who owns this number. This links to the Subscriber field of the Customers table
 
|} <br/>
 
|} <br/>
  
 
==== Currencies table ====
 
==== Currencies table ====
  
===== Description =====
+
The currencies table shows the currencies used by x164 system. Profiles are linked to records in this table by the Curr_code field. In the routing process, all the rates retrieved for a destination must be exchanged to the same currency to decide which one is the most profitable.
 
+
The currencies table shows the currencies used by x164 system. They are used in the routing process to look for the most appropriate route.
+
 
+
===== Data fields =====
+
 
   
 
   
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
 
|Id || Automatically generated id field
 
|Id || Automatically generated id field
 
|-
 
|-
|Reseller || ID number
+
|Reseller || ID string of reseller
 
|-
 
|-
 
|Domain || Not used
 
|Domain || Not used
 
|-
 
|-
|Currency || Currency id in the system, use ISO format adding reseller number to be unique in the system
+
|Currency || Currency id in the system, use ISO format adding reseller number to be unique in the system. This field is linked to the Curr_code field in the Profiles table.
 
|-
 
|-
 
|Curr_rate || Value of the currency, against the euro
 
|Curr_rate || Value of the currency, against the euro
Line 293: Line 333:
 
==== Quota table ====
 
==== Quota table ====
  
===== Description =====
+
The quota table is used to set monthly credit limits for subscribers. It keeps track of the monthly bill sum and blocks the subscriber when it reaches the amount specified in Quota. [http://wiki.x164.com/index.php/Howto#How_do_I_limit_the_usage_of_a_subscriber_per_month.3F Here]  you can find more information.
 
+
The quota table stores the billed sum of calls made by each subscriber. The table allows to set a monthly quota limit. When the limit is reached the subscriber is blocked. The usage is reset at the beginning of each month. Un-blocking of subscribers has to be done manually.
+
 
+
===== Data fields =====
+
  
 
{|  border="1" cellpadding="2"
 
{|  border="1" cellpadding="2"
 
|Id || automatically generated id field
 
|Id || automatically generated id field
 
|-  
 
|-  
|Reseller || ID number
+
|Reseller || ID string of reseller
 
|-
 
|-
|Subscriber || Subscriber name in the format "user@domain"
+
|Subscriber || Subscriber name in the format "user@domain". This field is linked to the Subscriber field of the Customers table or to the Carrier_name field in the Carriers table
 
|-
 
|-
 
|Domain || Subscriber domain
 
|Domain || Subscriber domain
Line 322: Line 358:
  
 
The operation takes the following parameters as inputs:
 
The operation takes the following parameters as inputs:
 
  
 
{|border="1" cellpadding="2"
 
{|border="1" cellpadding="2"
|qACD || Minimum Average Call Duration (seconds).  
+
|Average Call Duration || Minimum Average Call duration in seconds. Rates below this limit will be filtered out, unless there is no alternative that satisfies the limit for a given destination.  
 
|-
 
|-
|qASR || Minimum Answer Seizure Ratio (answered calls / total calls)
+
|Answer/Seizure Ratio || Minimum Answer/Seizure Ratio (answered calls / total calls). Rates below this limit will be filtered out, unless there is no alternative that satisfies the limit for a given destination.
 
|-
 
|-
|tolerance || Margin to consider prices as equal (%)
+
|Tolerance || Margin to consider prices as equal (%).
 
|-
 
|-
|max_code_lenght || Maximum length of the destination field to be kept in the final table
+
|Maximum Code Length || Maximum length of the destination field to be kept in the final table.
 
|-
 
|-
|minRate || All rates where the price is lesser than minRate will be updated to minRate
+
|Minimum Rate || All rates where the price is lesser than minRate will be updated to minRate
 
|-
 
|-
|profit || Profit margin to add to the price in %
+
|Profit || Profit margin to add to the price in %
 
|-
 
|-
 
|secret_key || Used for reseller authorization
 
|secret_key || Used for reseller authorization
 
|-
 
|-
|rateDate|| Date for which the rates will be retrieved.
+
|Date|| Date for which the rates will be retrieved.
 
|} <br/>
 
|} <br/>
  
 
+
In the first step all outgoing rates are retrieved, filtering by date and reseller id. The reseller id is found in the Gateways table using the secret_key parameter. The relationship with the Rates table is defined as folows:  
First rates are retrieved filtering by date and reseller id. The reseller id is found in the Gateways table using the secret_key parameter. The relationship with the Rates table is defined as folows:  
+
 
+
  
 
[[File:secretKey.png|center|800x800px]]
 
[[File:secretKey.png|center|800x800px]]
  
After this initial filtering the system searches for the best prices. For each destination code, the longest match per carrier is retrieved. Then the qACD and qASR parameters are taken in account. If any of the matches satisfies this limits, the cheapest route is selected. If the cheapest price is common to many routes, the one with the highest quality is picked. When none of the longest matches per company satisfies the quality limits, the process is the opposite: take the route with the highest quality firs, and if there is more than one choose the cheapest of them.  
+
Then the algorithm looks for the cheapest price for each destination, filtering out the rates that don't satisfy the ACD and ASR minimums. If there is no rate that satisfies this limit for a given destination, the rate with the best quality is chosen.
  
 
At the end of this process there will be one record for each destination dialing code. Before starting with the simplification stage, all records with price lesser than rateMin are set to rateMin.
 
At the end of this process there will be one record for each destination dialing code. Before starting with the simplification stage, all records with price lesser than rateMin are set to rateMin.
  
In the next steps, rates will be simplified using the tolerance parameter. First, redundant codes will be removed if shorter codes exist within their price tolerance. As an example, consider the following record:
+
In the next steps, rates will be simplified using the tolerance parameter. First, redundant codes will be removed if shorter codes exist within their price tolerance. As an example, consider the following records:
  
 
  Destination Price
 
  Destination Price
 
  371660 25
 
  371660 25
 +
3716 28
  
With a tolerance of 15%, this code would be deleted from the final selling table if a shorter match with price within the range [22.5 - 28.5] is found, such as:
+
With a tolerance of 15%, the record for 371660 would have a price range [22.5 - 28.5]. Since the shorter code 3716 is within this range, 371660 is considered redundant and deleted from the final table.
 
+
Destination Price
+
3716 26
+
  
 
In the second part of the simplification process, the algorithm groups sets of ten consecutive codes, like the following:
 
In the second part of the simplification process, the algorithm groups sets of ten consecutive codes, like the following:
Line 385: Line 416:
 
===CSV import and export===
 
===CSV import and export===
  
The x164 system supports CSV import and export to ease the task of updating the rating tables. CSV files are plain text files which store spreadsheet or database information, using commas to separate fields and line breaks to separate records. Rating related information will frequently be available in some spreadsheet format, so in order to upload it to the x164 database you will need to export to CSV first.
+
The x164 system supports CSV import and export to ease the task of updating the rating tables. CSV files are plain text files which store spreadsheet or database information. In the x164 system semicolons (;) are used to separate fields, and line breaks separate records. Rating related information will frequently be available in some spreadsheet format, so in order to upload it to the x164 database you will need to export to CSV first.
  
"Destination", "Price" // Example of CSV file with two fields ('Destination' and 'Price')
+
====Import a CSV file to the database====
34928, 120 // and two records.
+
349287, 100
+
  
====Export a spreadsheet file to CSV====
+
[http://wiki.x164.com/images/8/86/X164_test_csv_import_files.zip Download file examples for CSV import (rigth click - save file as)]
  
We will be using OpenOffice Calc for this example, although the process is similar in other spreadsheet softwares like Excel. First step is to reorder your data to fit the x164 format. Take as an example the following rates table with two records:
+
We will use OpenOffice Calc for this example, although the process is similar in other spreadsheet softwares like Excel. First step is to reorder your data to fit the x164 format. The necessary fields for each table are the following:
  
'''Country Country Dial $ USD Effective Date'''
 
Spain 34 0.258 Oct 09, 2012
 
Spain 34928 0.1757 Oct 09, 2012
 
  
Create a new spreadsheet where the first row contains the field names for the relevant x164 table, in this case Rates. The only exception is that the first field 'Id', that instead must be named 'ops' and set to '1' for every row. Then insert your data in the appropiate fields of the new spreadsheet:
+
'''Customers:'''
  
'''ops Reseller  Rate Destination  Region Description App Conn Price Conn In Price In  Start Date  End Date'''
+
file name format: customers_xxxxxxx.csv
1 100   Rate_Name 34 Spain Audio 2580   09-10-2012
+
1 100   Rate_Name 34928 Spain Audio 1757   09-10-2012
+
  
Note that CSV files use line breaks to separate records and commas to delimit fields. You must ensure those are not present in your data.
+
Example file name: customers_example.csv
  
To export the spreadsheet to a CSV file in OpenOffice, simply go to File -> Save As and select "Text CSV (.csv)". In the opened dialog you must rename the file with the name of the destination table, an underscore '_' and a number.
+
{| border="1" cellpadding="2"
 +
|ops|| Operation code: 1 Insert, 2 Update, 3 Delete
 +
|-
 +
|Reseller || ID string of reseller
 +
|-
 +
|Trusted Peer || Authorized IP address, in case the user is authorized by IP (Dynamic_IP = 0)
 +
|-
 +
|Domain || Not used
 +
|-
 +
|Subscriber || Subscriber name in the format "user@domain" used as billing party in the rate process
 +
|-
 +
|Password || Password for authorized users
 +
|-
 +
|Profile || Profile name which links the customer to a profile in the Profiles table  
 +
|-
 +
|Formats || Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)
 +
|-
 +
|RTPproxy || 1 activates RTP proxying for this route (only available for users with (only available for users with permission)
 +
|} <br/>
 +
'''Carriers:'''
  
rates_1.csv // CSV file names example for the Rates, Carriers and Profiles tables.
+
file name format: carriers_xxxxxxx.csv
carriers_25.csv
+
profiles_81.csv
+
  
====Import a CSV file to the database====
+
Example file name: carriers_example.csv
  
In the x164 web access, go to the destination table and click on 'Choose a file'. Select your file and click 'Import'. When the file is correctly uploaded a confirming message will be prompted. The imported data will be available after a few minutes.
+
{| border="1" cellpadding="2"
 +
 
 +
|ops|| Operation code: 1 Insert, 2 Update, 3 Delete
 +
|-
 +
|Reseller || ID string of reseller
 +
|-
 +
|Domain || Not used
 +
|-
 +
|Carrier_name || Carrier name in the format "user@domain" used as billing party in the rate process
 +
|-
 +
|Profile || Profile name which links the customer to a profile in the profile table
 +
|-
 +
|Formats || Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)
 +
|-
 +
|RTPproxy || 1 activates RTP proxying for this route (only available for users with (only available for users with permission)
 +
|} <br/>
 +
'''Profiles:'''
 +
 
 +
file name format: profiles_xxxxxxx.csv
 +
 
 +
Example file name: profiles_example.csv
 +
 
 +
{| border="1" cellpadding="2"
 +
|ops|| Operation code: 1 Insert, 2 Update, 3 Delete
 +
|-
 +
|Reseller || ID string of reseller
 +
|-
 +
|Profile || Profile name which links the customer or carrier to the profile table
 +
|-
 +
|Rate || Rate name which identifies the rates used for this profile in the Rates table
 +
|-
 +
|Starthourweek || Start hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
 +
|-
 +
|Endhourweek || End hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
 +
|-
 +
|Penalty || Constant price added to this rate. Used to penalize a tariff.
 +
|-
 +
|Timezone || Timezone must reflect the local time of the tariff in the rating profile table. The setting is used to correct the CDR timestamps coming from the softswitch which should be in GMT time. Use timezone identifier.
 +
|-
 +
|Curr_code || Currency used in iso format (EUR, USD ...), if you want use your own values the format should be iso and adding reseller number
 +
|-
 +
|Carrier || Possible profile types: <br />
 +
IN : for incoming routes<br />
 +
CARRIER: for outgoing carrier routes<br />
 +
DIDRANGE: defines a block of own numbers, numbers within such blocks are only routed to clients with DIDs
 +
|-
 +
|Tech_Prefix || Technical prefix used to identify incoming rate table. Different tech prefixes allow to link several rate tables to one incoming customer, e.g. to let the client chose dynamically grey, standard, premium rate tables. Prefixes must have two digits and when dialing they are used as follows: (prefix)#(called number)
 +
|} <br/>
 +
'''Rates:'''
 +
 
 +
file name format: rates_xxxxxxx.csv
 +
 
 +
Example file name: rates_example.csv
 +
 
 +
{| border="1" cellpadding="2" width=1000
 +
|ops|| Operation code: 1 Insert, 2 Update, 3 Delete
 +
|-
 +
|Reseller || ID string of reseller
 +
|-
 +
|Rate || ID of the rate
 +
|-
 +
|Destination || Destination number to this rate
 +
|-
 +
|Region || Region of this number
 +
|-
 +
|Description || Description of the destination to the number
 +
|-
 +
|App || Application Type: audio, sms
 +
|-
 +
|Conn || Price of the call connection
 +
|-
 +
|Price || Price per minute
 +
|-
 +
|Conn In || Cost of the call setup, to calculate the profit of the call
 +
|-
 +
|Price In || Cost per minute, to calculate the profit of the call
 +
|-
 +
|Start Date || The start time of the rate
 +
|-
 +
|End Date || The end time of the rate
 +
|} <br/>
 +
'''DIDclients:'''
 +
 
 +
file name format: didclients_xxxxxxx.csv
 +
 
 +
Example file name: didclients_example.csv
 +
 
 +
{| border="1" cellpadding="2"
 +
|ops|| Operation code: 1 Insert, 2 Update, 3 Delete
 +
|-
 +
|Reseller || ID string of reseller
 +
|-
 +
|DID_number || Number of the client
 +
|-
 +
|DID_subscriber || Subscriber who owns this number. This links to the Subscriber field of the Customers table
 +
|} <br/>
 +
 
 +
 
 +
Take as an example the following rates table:
 +
 
 +
[[File:rate_table.png|center]]
 +
 
 +
In order to import you have to adapt the data to the x164 format. Note that in the x164 system the date format is YYYY-MM-DD, and that the prices are stored as ten thousand times their value in the base currency without decimals.
 +
 
 +
Also avoid including semicolons or line breaks in your data, as these are used as field and record delimiters respectively.
 +
 
 +
Finally remember to fill the 'ops' field with the corresponding code: 1 for insertion, 2 for updating and 3 for deletion. In this case we are going to insert all the records.
 +
 
 +
[[File:rate_table_x164.png|center]]
 +
 
 +
To export the spreadsheet to a CSV file in OpenOffice, simply go to File -> Save As and select "Text CSV (.csv)". The file name must start with the name of the destination table, in this case 'rates'. A valid file name would be 'rates_1.csv'.
 +
 
 +
In the next menu you will be asked to select a field delimiter and a text delimiter. Choose the semicolon (;) as your field delimiter and leave the text delimiter empty. Save the file.
 +
 
 +
To import the file, select the 'Rating' tab in the x164 web access and click on 'Choose a file'. Select your file and click 'Import'. When the file is correctly uploaded a confirming message will be prompted. The imported data will be available after a few minutes. You can check the number of imported rows in the 'Logs' tab.
  
====Export table as CSV file====
+
====Export x164 table to a CSV file====
  
 
You can also export data from the database in CSV format by clicking on the 'Export table.csv' button on the right side of a table. A new browser window will be opened showing the CSV text.
 
You can also export data from the database in CSV format by clicking on the 'Export table.csv' button on the right side of a table. A new browser window will be opened showing the CSV text.
Line 429: Line 584:
 
==== Time zone ====
 
==== Time zone ====
  
The server running yate should have its timezone set to GMT time if the timezone setting is used in the rating customers table. The timezone setting in the rating customer table must reflect the local time of the tariff in the rating profile table. The timezone setting is used to correct the CDR timestamps coming from the softswitch. The Starthourweek and Endhourweek time ranges in the rating profiles table are always in local time.
+
The server running yate should have its timezone set to GMT time if the timezone setting is used in the rating customers table. The timezone setting in the rating customer table must reflect the local time of the tariff in the Profiles table. The timezone setting is used to correct the CDR timestamps coming from the softswitch. The Starthourweek and Endhourweek time ranges in the rating profiles table are always in local time.
  
 
=== CDR module - cdrbuild.conf ===
 
=== CDR module - cdrbuild.conf ===
 
===== Description =====
 
  
 
This module builds the CDR messages (Call Details Record) which are used later in the radius module. Here are set the necessary attributes to create the correct CDR messages.
 
This module builds the CDR messages (Call Details Record) which are used later in the radius module. Here are set the necessary attributes to create the correct CDR messages.
  
 
=== h323 Channel  module - h323chan.conf ===
 
=== h323 Channel  module - h323chan.conf ===
 
===== Description =====
 
  
 
This module gives support to h323 protocol by using the open h323 library.
 
This module gives support to h323 protocol by using the open h323 library.
  
 
===  Mysql database module - mysqldb.conf ===  
 
===  Mysql database module - mysqldb.conf ===  
 
===== Description =====
 
  
 
This module is used to make the connection between yate and a MySQL database.  Establishing the necessary parameters as host, port, database and password.
 
This module is used to make the connection between yate and a MySQL database.  Establishing the necessary parameters as host, port, database and password.
  
 
=== Radius module - yradius.conf ===
 
=== Radius module - yradius.conf ===
 
===== Description =====
 
  
 
This module give support to establish communication between Yate and FreeRADIUS, as well the ip address and port of the FreeRADIUS server. Are set the specific attributes to sent in the CDR message and are assigned the correct values.
 
This module give support to establish communication between Yate and FreeRADIUS, as well the ip address and port of the FreeRADIUS server. Are set the specific attributes to sent in the CDR message and are assigned the correct values.
  
 
=== Regexroute module - regexroute.conf ===
 
=== Regexroute module - regexroute.conf ===
===== description =====
+
 
 
This module is used in addition to the register module, to assign values ​​of different parameters in the call as the error messages or the formats to use in transcoding calls, used to route calls without using database.
 
This module is used in addition to the register module, to assign values ​​of different parameters in the call as the error messages or the formats to use in transcoding calls, used to route calls without using database.
  
Line 464: Line 611:
  
 
==== Authuser ====
 
==== Authuser ====
 
===== Description =====
 
  
 
User_Auth is used to identify the subscriber.
 
User_Auth is used to identify the subscriber.
 
===== Statement =====
 
  
 
  PROCEDURE `proc_user_auth`(  
 
  PROCEDURE `proc_user_auth`(  
Line 477: Line 620:
 
  IN password VARCHAR(25)    // secret key for MySQL procedures in Yate
 
  IN password VARCHAR(25)    // secret key for MySQL procedures in Yate
 
  )
 
  )
 +
 +
Output:
 +
 +
- authname: subscriber in the Customers table.
 +
- password (only in case of dynamic IP) : password for this subscriber.
  
 
==== Register ====
 
==== Register ====
 
===== Description =====
 
  
 
This query handle register messages, add in database data of register users and the last time that the user was registered.
 
This query handle register messages, add in database data of register users and the last time that the user was registered.
  
===== Statement =====
 
 
  PROCEDURE `proc_user_register`(  
 
  PROCEDURE `proc_user_register`(  
 
  IN ip_host VARCHAR(30), // IP address received in SIP INVITE
 
  IN ip_host VARCHAR(30), // IP address received in SIP INVITE
Line 492: Line 637:
 
  IN password VARCHAR(25) // secret key for MySQL procedures in Yate
 
  IN password VARCHAR(25) // secret key for MySQL procedures in Yate
 
  )
 
  )
 +
 +
Output: no output.
  
 
==== Unregister ====
 
==== Unregister ====
 
===== Description =====
 
  
 
This query handle unregister messages initializing the data entered by register message.
 
This query handle unregister messages initializing the data entered by register message.
  
===== Statement =====
 
 
  PROCEDURE `proc_user_unregister`(
 
  PROCEDURE `proc_user_unregister`(
 
  IN authname VARCHAR(125)        // authorized subscriber name corresponding in data base
 
  IN authname VARCHAR(125)        // authorized subscriber name corresponding in data base
 
  IN password VARCHAR(25)        // secret key for MySQL procedures in Yate
 
  IN password VARCHAR(25)        // secret key for MySQL procedures in Yate
 
  )
 
  )
 +
 +
Output: no output.
  
 
==== Engine timer ====
 
==== Engine timer ====
 
===== Description =====
 
  
 
The engine timer found that users have exceeded the time of registration and invalidate the dynamic_ip.
 
The engine timer found that users have exceeded the time of registration and invalidate the dynamic_ip.
  
===== Statement =====
+
  PROCEDURE `proc_enginer_timer`(
  PROCEDURE `proc_user_enginer_timer`(
+
 
  IN password VARCHAR(25)      // secret key for MySQL procedures in Yate
 
  IN password VARCHAR(25)      // secret key for MySQL procedures in Yate
 
  )
 
  )
 +
 +
Output: no output.
  
 
==== Preroute ====
 
==== Preroute ====
 
===== Description =====
 
  
 
Preroute checks whether an incoming route for the combination of IP address and called number or authname and called number exists. The caller is either identified by IP address or was identified by authname/password combination in authname procedure. If no incoming route exists the call is blocked.
 
Preroute checks whether an incoming route for the combination of IP address and called number or authname and called number exists. The caller is either identified by IP address or was identified by authname/password combination in authname procedure. If no incoming route exists the call is blocked.
 
===== Statement =====
 
  
 
  PROCEDURE `proc_get_preroute`(  
 
  PROCEDURE `proc_get_preroute`(  
Line 530: Line 671:
 
  IN password VARCHAR(25)      // secret key for MySQL procedures in Yate
 
  IN password VARCHAR(25)      // secret key for MySQL procedures in Yate
 
  )
 
  )
 +
 +
Output:
 +
 +
- username: caller's Subscriber in the Customers table.
 +
 +
- usernameSell: same as username.
 +
 +
- usernameNoBuy:  caller's Subscriber_out in the customers table.
 +
 +
- rtpproxy_in: flag indicating if the incoming leg supports RTP proxy.
 +
 +
- realRateSell: price per minute of the found incoming rate in the base currency.
 +
 +
- realConnecSell: connect cost of the found incoming rate in the base currency.
 +
 +
- rateIdSell: Id of the found incoming route.
 +
 +
- token: hash generated with the increase of the call counter. This token must be input to the proc_cdr_finalize procedure in order to decrease the counter when the call finishes.
  
 
==== Route ====
 
==== Route ====
 
===== Description =====
 
  
 
This selects the possible outgoing routes according to the incoming parameters, looking for the best quality and profit. Unprofitable routes are blocked.
 
This selects the possible outgoing routes according to the incoming parameters, looking for the best quality and profit. Unprofitable routes are blocked.
 
===== Statement =====
 
  
 
  PROCEDURE `proc_get_route`(  
 
  PROCEDURE `proc_get_route`(  
Line 547: Line 702:
 
  IN password VARCHAR(25)        // secret key for MySQL procedures in Yate
 
  IN password VARCHAR(25)        // secret key for MySQL procedures in Yate
 
  )
 
  )
 +
 +
Output for DID destinations:
 +
 +
- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the subscriber in the Customers table that the called number is linked to.
 +
 +
- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.
 +
 +
- username: Suscriber field in the Customers table with prefix "did_".
 +
 +
- formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.
 +
 +
 +
Output for other destinations:
 +
 +
- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the carrier in the Carries table that the route is linked to.
 +
 +
- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.
 +
 +
- username: Suscriber field in the Customers table with prefix "did_".  formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.
 +
 +
- rateIdBuy: Id of the found rate.
 +
 +
- expProfit: expected profit, calculated using the incoming and outgoing rates and connect costs and the Average Call Duration of the outgoing route.
  
 
+
==== Route V3 ====
==== Route V2 ====
+
 
+
===== Description =====
+
  
 
Selects the possible outgoing routes according to the incoming parameters. It also allows to select the routing method, set quality limits, and enable loss making calls.
 
Selects the possible outgoing routes according to the incoming parameters. It also allows to select the routing method, set quality limits, and enable loss making calls.
  
===== Statement =====
+
  PROCEDURE `proc_get_route_v3`(  
 
+
  PROCEDURE `proc_get_route_v2`(  
+
 
  IN usernameNobuy VARCHAR(125), // Subscriber_out found in incoming route to prevent call loops
 
  IN usernameNobuy VARCHAR(125), // Subscriber_out found in incoming route to prevent call loops
 
  IN rtproxy_in TINYINT(4), // 0/1 flag to specify whether the rtp stream of the incoming call leg is proxied.
 
  IN rtproxy_in TINYINT(4), // 0/1 flag to specify whether the rtp stream of the incoming call leg is proxied.
  IN realRateSell FLOAT, // (client) call rate found in preroute expressed in the base currency (EUR)  
+
  IN realRateSell DECIMAL(18,8), // (client) call rate found in preroute expressed in the base currency (EUR)
 +
IN realconnectSell DECIMAL(18,8),      // (client) connect cost found in preroute expressed in the base currency (EUR)  
 
  IN called VARCHAR(100), // Called number (optionally with prefix). The prefix is not used.
 
  IN called VARCHAR(100), // Called number (optionally with prefix). The prefix is not used.
 
  IN _format_in VARCHAR(255), // Codecs received in incoming call leg
 
  IN _format_in VARCHAR(255), // Codecs received in incoming call leg
Line 567: Line 741:
 
  IN qACD INT, // Minimum Average Call Duration. Routes below this limit are blocked.
 
  IN qACD INT, // Minimum Average Call Duration. Routes below this limit are blocked.
 
  IN qASR INT, // Minimum Success Rate (successful calls/total calls). Routes below this limit are blocked.  
 
  IN qASR INT, // Minimum Success Rate (successful calls/total calls). Routes below this limit are blocked.  
  IN blocklosscalls TINYINT(4)) // 0/1 flag, blocks unprofitable calls when 0
+
  IN blocklosscalls TINYINT(4)) // 0/1 flag, blocks unprofitable calls when 1
 
  )
 
  )
 +
 +
Output for DID destinations:
 +
 +
- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the subscriber in the Customers table that the called number is linked to.
 +
 +
- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.
 +
 +
- username: Suscriber field in the Customers table with prefix "did_".
 +
 +
- formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.
 +
 +
 +
Output for other destinations:
 +
 +
- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the carrier in the Carries table that the route is linked to.
 +
 +
- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.
 +
 +
- username: Suscriber field in the Customers table with prefix "did_".  formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.
 +
 +
- rateIdBuy: Id of the found rate.
 +
 +
- expProfit: expected profit, calculated using the incoming and outgoing rates and connect costs and the Average Call Duration of the outgoing route.
  
 
==== cdr_finalize ====
 
==== cdr_finalize ====
 
===== Description =====
 
  
 
This procedure computes the values ​​of the call once finished to update the statistics in the system.
 
This procedure computes the values ​​of the call once finished to update the statistics in the system.
 
===== Statement =====
 
  
 
  PROCEDURE `proc_cdr_finalize`(  
 
  PROCEDURE `proc_cdr_finalize`(  
Line 586: Line 779:
 
  IN rateidBuy BIGINT(20),  // id of the rate for the outgoing call leg
 
  IN rateidBuy BIGINT(20),  // id of the rate for the outgoing call leg
 
  IN rateidSell BIGINT(20),  // id of the rate for the incoming call leg
 
  IN rateidSell BIGINT(20),  // id of the rate for the incoming call leg
  IN password VARCHAR(25)   // secret key for MySQL procedures in Yate
+
  IN password VARCHAR(25)// secret key for MySQL procedures in Yate
 +
IN token VARCHAR(32)      // decreases the call counter using the token given in proc_get_preroute
 
  )
 
  )
 +
 +
Output: no output.
  
 
=== RTP Channel  module - yrtpchan.conf ===
 
=== RTP Channel  module - yrtpchan.conf ===
 
===== Description =====
 
  
 
This module provides RTP and udptl transports for any technology that requieres it as SIP or H.323. The RTCP support is disabled.
 
This module provides RTP and udptl transports for any technology that requieres it as SIP or H.323. The RTCP support is disabled.
  
 
=== SIP Channel  module - ysipchan.conf ===
 
=== SIP Channel  module - ysipchan.conf ===
 
===== Description =====
 
  
 
This module give support to SIP protocol using the YASS library. Here also is posible select the value "expires" used in register.conf and the codecs enable to use.
 
This module give support to SIP protocol using the YASS library. Here also is posible select the value "expires" used in register.conf and the codecs enable to use.
Line 603: Line 795:
 
=== Yate - yate.conf ===
 
=== Yate - yate.conf ===
  
===== Description =====
 
  
 
In this configuration file is selected the modules that are in use, and the parameter "timeout" limits the call duration as 2h.
 
In this configuration file is selected the modules that are in use, and the parameter "timeout" limits the call duration as 2h.

Latest revision as of 08:58, 10 October 2019

Here are a few links you can start from. In addition, you might want to take a look at the list of all categories or all pages.

Contents

[edit] x164 Introduction

x164 consists of SBC softswitches which are installed as virtual machines at local customer premises or in the cloud. SBC softswitches are managed online in the x164 management platform which holds rate tables, statistics and route configurations. The management system collects statistical information in realtime so that routes can be optimized continuously. Call detail records are collected in a radius database and are rated in the CDR module. The management of x164 happens online.

Routing.png

[edit] Features

Management

  • Cloud based management Web-interface
  • Administration of multiple SBC with one interface
  • Reseller functionality
  • User and permissions management
  • Monitoring of active sessions and call history
  • Statistics and call rating on completed sessions

Security

  • The SBC is a B2BUA which separates the call legs hiding the network topology
  • TLS and SRTP
  • Firewall, IP Black lists, IP White lists
  • Enforce expenditure limits so excessive traffic from certain nodes is automatically blocked.
  • Load balancing, unlimited number of SBC, clustered databases

Routing


  • Routing between unlimited number of nodes, domains, switches
  • Time-based Routing
  • Routing based on destination number, source number and redirecting number
  • Routing / blocking of calls based on profit parameters, block unprofitable calls
  • Routing based on prefix, extension ranges
  • Number porting, number translation
  • Manipulation of destination number, source number
  • Manipulation before, during and after routing
  • Failover routes
  • Least-cost-routing

Transport protocols

  • IPv4, IPv6
  • UDP, TCP, TLS
  • NAT

Signaling

  • SIP
  • H.323

Media

  • RTP / SRTP
  • Media Pass-through, Media Transcoding, Media Bypass
  • Codecs G.711 a-law, u-law, gsm, libc10, ilbs, amr, slin, g723,g726,g728,G.729
  • T.38 Fax


[edit] Database

The x164 database stores CDRs, rating tables, route statistics and client information. From the web access you can easily manage the database and perform several tasks such as uploading rate tables, setting up credit limits for customers, and blocking bad routes.

Carriers and Customers are defined separately in their own tables, and they are linked to a profile in Profiles, which in turn is attached to a set of rates in the Rates table. A profile can be of type 'IN' (links customers to incoming rates), 'CARRIER' (links carriers to outgoing rates ), or 'DIDRANGE' (routes that terminate in your own network). DID numbers are defined in DIDcients. The table relationship is as follows:


TableRelationship.png

It is possible to allow the user to choose dynamically between different rate sets by using prefix dialing. This is accomplished by creating many instances of the same incoming profile and setting a different rate name and prefix for each one of them. Rates associated with this profiles will only be available when dialing the prefix. A more detailed explanation can be found here.

Currencies sets the exchange rate to euros for each currency. When looking up routes, the field 'curr_code' in Profiles links to the matching exchange rate, and the price for routes is normalized according to it.

Finally, monthly credit limits for subscribers can be set in the Quota table. This table keeps record of the monthly bill sum for each subscriber. If a quota is set and the limit is reached, the subscriber is blocked. This means the field 'blocked' of its entry in the Customers or Carriers table is set to 1. Unblocking must be done manually.

[edit] Call flow

When receiving a call, the softswitch queries the database for user authentication using the Authuser procedure. The flag 'Dynamic_IP' in Customers indicates if the customer uses fixed or dynamic IP. In the first case, authentication is made by IP. In the second, the fields 'Subscriber' and 'Password' are used.

If the authentication is positive, the softswith calls the Preroute procedure to check that the user is allowed to call the dialed number. The user's profile is linked to a set of rates that define the allowed destinations. If there is a match between the called number and one of this rates, the softswitch looks up the database for outgoing rates.

Outgoing rates are retrieved with the Route procedure. The algorithm retrieves the rates with the longest code match for each carrier, and calculates their profitability. Only rates that generate revenue are returned. The softswitch attempts to route the call using this rates, starting from the most to the least profitable until the call is effectively routed.

When the call finishes, a CDR is created and the rate's statistics are updated with the cdr_finalize procedure.

CallFlow.png X164scheme.png

[edit] Web Access

x164 provides its members a web access to configure their settings, upload their rate tables and view call statistics. The interface and rating-engine is derived from CDRTool, which we modified heavily for speed and simplification.

[edit] Call search menu

The call search offers access to Call Detail Records (CDRs). CDRs can be summarized and filtered for various statistics.

Data source Database where are the call details
Start time Beginning of the range of time in search
Stop time End of the range of time in search
Sip call / Sip source Filter by user ID, received from the customer or proxy
User agents / Media code Filter by the format of the call
Sip Billing Party (username) Search the calls of a subscriber
Sip Caller Party (From URI) Filter using the ID received from the caller
Sip destination (Canonical URI) Filter by destination of the call
Duration / Application / status Filter selecting different call duration, media or the status of the call
Order by / Group by Complements the search ordering results, change the limit of records to show, grouping these and if ReNormalize is marked the system recalculates the call prices

[edit] Rating menu

Access to all data influencing the rating and routing. The rating data is contained in several tables which can be selected on the top-right side. The cost calculation of the calls stored in the system occurs in parallel and periodically using the values that the user introduces ​​in this tables.

[edit] Customers table

The Customers table shows details of your authorized users who may send calls through the x164 system. Customers can be authorized by Trusted Peer when they use fixed IP or Subscriber and Password for dynamic IP users.

Customers are linked to incoming profiles via the Profile field. In turn, this profiles link to a set of incoming rates that determine the destinations that the customer is allowed to call.

When a customer number is within a DID block, the Subscriber field links to an entry in the DIDclients table that defines the user's number. This field is also used to set up quota limits for customers in the Quota Usage table.

Id Automatically generated id field
Reseller ID string of reseller
Trusted Peer Authorized IP address, in case the user is authorized by IP (Dynamic_IP = 0)
Domain Not used
Dynamic_ip Use dynamic IP when value set to 1
Subscriber Subscriber name in the format "user@domain" used as billing party in the rate process
Password Password for authorized users
Profile Profile name which links the customer to a profile in the Profiles table
Subscriber_out In case the subscriber also provides outgoing routes, put outgoing subscriber name here to avoid looping calls
Blocked Blocks the subscriber when is set to 1
Pre_location Parameters that are added before the called number in the outgoing message (sip/sip:) (possible values: sip/00 to identify a SIP carrier with prefix of 00 in front of the e164 number)
Post_location URL and parameters added to the called number in the outgoing message, e.g. @carrier.com
The outgoing route is defined as: pre-location + e164 number + post-location, e.g. sip/sip:4930123456789@carrier.com
Expires Expiration time of the dynamic IP
Formats Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)
rtpProxy 1 activates RTP proxying for this route

[edit] Carriers table

The Carriers table has the details of your carriers to send calls to them. A carrier has an unique 'CARRIER' profile, which is attached to its available outgoing rates. Carrier_name can be used to set a quota limit in the Quota usage table.

Id Automatically generated id field
Reseller ID string of reseller
Domain Not used
Carrier_name Carrier name in the format "user@domain" used as billing party in the rate process
Profile Profile name which links the customer to a profile in the profile table
Blocked Block the subscriber when value set to 1
Pre_location Parameters that are added before the called number in the outgoing message (sip/sip:)(possible values: SIP/00 to identify a SIP carrier with prefix of 00 in front of the e164 number)
Post_location URL and parameters added to the called number in the outgoing message, e.g. @carrier.com
The outgoing route is defined as: pre-location + e164 number + post-location, e.g. sip/sip:4930123456789@carrier.com
Line Section identifier from accfile.conf, this can be used instead of pre-location, post-location
Formats Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)
rtpProxy 1 activates rtp proxying for this route

[edit] Profiles table

The Profiles table links customers, carriers and DID blocks to their respective rates. It also sets rate plan details such as valid week hours, minimum charged price, and currency in which the rates are expressed.

There are three type of profiles: 'IN', 'CARRIER' and 'DIDRANGE'. 'IN' profiles link customers with incoming rates. The field Tech_prefix is used in 'IN' profiles to enable prefix dialing, as explained here.

'CARRIER' profiles link carriers with outgoing routes. A carrier may have several rate plans and different time frames and penalties can be set for each of them.

'DIDRANGE' is used to define blocks of own numbers. The range is defined in the Rates table, and customers with numbers within this range are set in the DIDclients table.

Id Automatically generated id field
Reseller ID string of reseller
Profile Profile name which links the customer or carrier to the profile table
Rate Rate name which identifies the rates used for this profile in the Rates table
Starthourweek Start hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
Endhourweek End hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
Penalty Constant price added to this rate. Used to penalize a tariff.
Timezone Timezone must reflect the local time of the tariff in the rating profile table. The setting is used to correct the CDR timestamps coming from the softswitch which should be in GMT time. Use timezone identifier.
Incr Used to consider the duration of the call in increments (default 1 second)
Min_Dur Minimum duration time charged of the call, only activated when the call is successful
Curr_code Currency used in iso format (EUR, USD ...), if you want use your own values the format should be iso and adding reseller number
Carrier Possible profile types:

IN : for incoming routes
CARRIER: for outgoing carrier routes
DIDRANGE: defines a block of own numbers, numbers within such blocks are only routed to clients with DIDs

Tech_Prefix Technical prefix used to identify incoming rate table. Different tech prefixes allow to link several rate tables to one incoming customer, e.g. to let the client chose dynamically grey, standard, premium rate tables. Prefixes must have two digits and when dialing they are used as follows: (prefix)#(called number)

[edit] Rates table

The Rates table contains the rate information used by x164 to pick routes and calculate tariffs. Statistics for call duration and success rate are stored here and updated in real time every time a rate is used.

All prices must be defined as the original price multiplied by ten thousand. For example, for a rate of 0.1234 Euros, the input price in the x164 system should be 1234.

Id Automatically generated id field
Reseller ID string of reseller
Rate ID of the rate
Destination Destination number to this rate
Region Region of this number
Description Description of the destination to the number
App Application Type: audio, sms
Conn Price of the call connection
Price Price per minute
Conn In Cost of the call setup, to calculate the profit of the call
Price In Cost per minute, to calculate the profit of the call
Start Date The start time of the rate
End Date The end time of the rate
Blocked Lock indicator of the rate
Billtime_sum Sum of billed time of this rate
Ringtime_sum Sum of ring time of this rate
Setuptime_sum Sum of setup time (until ringing) of this rate
Calls_count Number of calls of this rate
Success_count Number of connected calls
Acd_short Short-term average call duration, updated after each call with acd_short = ((5 * acd_short) + _billtime)/6,
Acd_avr Long-term average call duration, updated after each call with acd_avr = (acd_short + (billtime_sum / success_count)) / 2

[edit] Gateways table

The gateways table serves to identify the IP addresses of the switches used by the reseller.

Id Automatically generated id field
Reseller ID string of reseller
Gateway IP address of the switch
Secret Switch's password

[edit] DIDclients table

DIDclients is used to associate a DID number with a subscriber. When a call is being routed and the retrieved rate is attached to a 'DIDRANGE' profile, the system refers to this table to identify the subscriber who owns the number. See how to set up a DID subscriber here.

Id Automatically generated id field
Reseller ID string of reseller
DID_number Number of the client
DID_subscriber Subscriber who owns this number. This links to the Subscriber field of the Customers table

[edit] Currencies table

The currencies table shows the currencies used by x164 system. Profiles are linked to records in this table by the Curr_code field. In the routing process, all the rates retrieved for a destination must be exchanged to the same currency to decide which one is the most profitable.

Id Automatically generated id field
Reseller ID string of reseller
Domain Not used
Currency Currency id in the system, use ISO format adding reseller number to be unique in the system. This field is linked to the Curr_code field in the Profiles table.
Curr_rate Value of the currency, against the euro

[edit] Quota table

The quota table is used to set monthly credit limits for subscribers. It keeps track of the monthly bill sum and blocks the subscriber when it reaches the amount specified in Quota. Here you can find more information.

Id automatically generated id field
Reseller ID string of reseller
Subscriber Subscriber name in the format "user@domain". This field is linked to the Subscriber field of the Customers table or to the Carrier_name field in the Carriers table
Domain Subscriber domain
Quota Quota limit per month
Notified Date on which the system detected the exceeded limit
This Month Monthly cumulative consumption
Today Daily cumulative consumption

[edit] Generation of client rate tables

x164 allows to generate rate tables for customers from outgoing carrier rate tables. x164 consolidates the carrier rates into one rate table following a strict longest-code-match logic. The rate table can be further simplified by filtering for quality or consolidating prices within tolerances to one code/price.

The operation takes the following parameters as inputs:

Average Call Duration Minimum Average Call duration in seconds. Rates below this limit will be filtered out, unless there is no alternative that satisfies the limit for a given destination.
Answer/Seizure Ratio Minimum Answer/Seizure Ratio (answered calls / total calls). Rates below this limit will be filtered out, unless there is no alternative that satisfies the limit for a given destination.
Tolerance Margin to consider prices as equal (%).
Maximum Code Length Maximum length of the destination field to be kept in the final table.
Minimum Rate All rates where the price is lesser than minRate will be updated to minRate
Profit Profit margin to add to the price in %
secret_key Used for reseller authorization
Date Date for which the rates will be retrieved.

In the first step all outgoing rates are retrieved, filtering by date and reseller id. The reseller id is found in the Gateways table using the secret_key parameter. The relationship with the Rates table is defined as folows:

SecretKey.png

Then the algorithm looks for the cheapest price for each destination, filtering out the rates that don't satisfy the ACD and ASR minimums. If there is no rate that satisfies this limit for a given destination, the rate with the best quality is chosen.

At the end of this process there will be one record for each destination dialing code. Before starting with the simplification stage, all records with price lesser than rateMin are set to rateMin.

In the next steps, rates will be simplified using the tolerance parameter. First, redundant codes will be removed if shorter codes exist within their price tolerance. As an example, consider the following records:

Destination	Price
371660		25
3716		28

With a tolerance of 15%, the record for 371660 would have a price range [22.5 - 28.5]. Since the shorter code 3716 is within this range, 371660 is considered redundant and deleted from the final table.

In the second part of the simplification process, the algorithm groups sets of ten consecutive codes, like the following:

Destination	Price
3710		50
3711		50
3712		45
3713		51
3714		47
3715		48
3716		49
3717		50
3718		47
3719		46

First the system makes sure the shorter code (371) does not already exist in the database. If it doesn't, it checks that all the prices are within the tolerance range. In the previous table case, for a tolerance of 15%, the cheapest price upper limit would be 45*(1+15/100) = 51.75, which is superior to the highest price in the set. Thus, this set is removed from the final table and a new record is created, using the information of the most expensive code, and updating the destination field to the one that comprehends the whole set:

Destination	Price
371		51

Once the simplification process is over, codes longer than max_code_length are deleted. Finally, all the prices are increased according to the profit percentage specified in the input.

[edit] CSV import and export

The x164 system supports CSV import and export to ease the task of updating the rating tables. CSV files are plain text files which store spreadsheet or database information. In the x164 system semicolons (;) are used to separate fields, and line breaks separate records. Rating related information will frequently be available in some spreadsheet format, so in order to upload it to the x164 database you will need to export to CSV first.

[edit] Import a CSV file to the database

Download file examples for CSV import (rigth click - save file as)

We will use OpenOffice Calc for this example, although the process is similar in other spreadsheet softwares like Excel. First step is to reorder your data to fit the x164 format. The necessary fields for each table are the following:


Customers:

file name format: customers_xxxxxxx.csv

Example file name: customers_example.csv

ops Operation code: 1 Insert, 2 Update, 3 Delete
Reseller ID string of reseller
Trusted Peer Authorized IP address, in case the user is authorized by IP (Dynamic_IP = 0)
Domain Not used
Subscriber Subscriber name in the format "user@domain" used as billing party in the rate process
Password Password for authorized users
Profile Profile name which links the customer to a profile in the Profiles table
Formats Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)
RTPproxy 1 activates RTP proxying for this route (only available for users with (only available for users with permission)

Carriers:

file name format: carriers_xxxxxxx.csv

Example file name: carriers_example.csv

ops Operation code: 1 Insert, 2 Update, 3 Delete
Reseller ID string of reseller
Domain Not used
Carrier_name Carrier name in the format "user@domain" used as billing party in the rate process
Profile Profile name which links the customer to a profile in the profile table
Formats Possible codec formats separated by comma (possible values: g729, ulaw, alaw, t38)
RTPproxy 1 activates RTP proxying for this route (only available for users with (only available for users with permission)

Profiles:

file name format: profiles_xxxxxxx.csv

Example file name: profiles_example.csv

ops Operation code: 1 Insert, 2 Update, 3 Delete
Reseller ID string of reseller
Profile Profile name which links the customer or carrier to the profile table
Rate Rate name which identifies the rates used for this profile in the Rates table
Starthourweek Start hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
Endhourweek End hour in the week of this tariff (possible value range 0 - 167) 0 hour is Sunday 0:00 hour in local time
Penalty Constant price added to this rate. Used to penalize a tariff.
Timezone Timezone must reflect the local time of the tariff in the rating profile table. The setting is used to correct the CDR timestamps coming from the softswitch which should be in GMT time. Use timezone identifier.
Curr_code Currency used in iso format (EUR, USD ...), if you want use your own values the format should be iso and adding reseller number
Carrier Possible profile types:

IN : for incoming routes
CARRIER: for outgoing carrier routes
DIDRANGE: defines a block of own numbers, numbers within such blocks are only routed to clients with DIDs

Tech_Prefix Technical prefix used to identify incoming rate table. Different tech prefixes allow to link several rate tables to one incoming customer, e.g. to let the client chose dynamically grey, standard, premium rate tables. Prefixes must have two digits and when dialing they are used as follows: (prefix)#(called number)

Rates:

file name format: rates_xxxxxxx.csv

Example file name: rates_example.csv

ops Operation code: 1 Insert, 2 Update, 3 Delete
Reseller ID string of reseller
Rate ID of the rate
Destination Destination number to this rate
Region Region of this number
Description Description of the destination to the number
App Application Type: audio, sms
Conn Price of the call connection
Price Price per minute
Conn In Cost of the call setup, to calculate the profit of the call
Price In Cost per minute, to calculate the profit of the call
Start Date The start time of the rate
End Date The end time of the rate

DIDclients:

file name format: didclients_xxxxxxx.csv

Example file name: didclients_example.csv

ops Operation code: 1 Insert, 2 Update, 3 Delete
Reseller ID string of reseller
DID_number Number of the client
DID_subscriber Subscriber who owns this number. This links to the Subscriber field of the Customers table


Take as an example the following rates table:

Rate table.png

In order to import you have to adapt the data to the x164 format. Note that in the x164 system the date format is YYYY-MM-DD, and that the prices are stored as ten thousand times their value in the base currency without decimals.

Also avoid including semicolons or line breaks in your data, as these are used as field and record delimiters respectively.

Finally remember to fill the 'ops' field with the corresponding code: 1 for insertion, 2 for updating and 3 for deletion. In this case we are going to insert all the records.

Rate table x164.png

To export the spreadsheet to a CSV file in OpenOffice, simply go to File -> Save As and select "Text CSV (.csv)". The file name must start with the name of the destination table, in this case 'rates'. A valid file name would be 'rates_1.csv'.

In the next menu you will be asked to select a field delimiter and a text delimiter. Choose the semicolon (;) as your field delimiter and leave the text delimiter empty. Save the file.

To import the file, select the 'Rating' tab in the x164 web access and click on 'Choose a file'. Select your file and click 'Import'. When the file is correctly uploaded a confirming message will be prompted. The imported data will be available after a few minutes. You can check the number of imported rows in the 'Logs' tab.

[edit] Export x164 table to a CSV file

You can also export data from the database in CSV format by clicking on the 'Export table.csv' button on the right side of a table. A new browser window will be opened showing the CSV text.

[edit] Softswitch

The x164 switch is based on yate, In its basic configuration the switch can handle SIP and H323 calls. IAX, ISDN, SS7 calls are theoretically possible. Users can activate further yate modules to extend the possibilities. x164 members are encouraged to post their suggestions and ideas on the forum. The yate configuration is located in /usr/local/etc/yate.

[edit] Server settings

[edit] Time zone

The server running yate should have its timezone set to GMT time if the timezone setting is used in the rating customers table. The timezone setting in the rating customer table must reflect the local time of the tariff in the Profiles table. The timezone setting is used to correct the CDR timestamps coming from the softswitch. The Starthourweek and Endhourweek time ranges in the rating profiles table are always in local time.

[edit] CDR module - cdrbuild.conf

This module builds the CDR messages (Call Details Record) which are used later in the radius module. Here are set the necessary attributes to create the correct CDR messages.

[edit] h323 Channel module - h323chan.conf

This module gives support to h323 protocol by using the open h323 library.

[edit] Mysql database module - mysqldb.conf

This module is used to make the connection between yate and a MySQL database. Establishing the necessary parameters as host, port, database and password.

[edit] Radius module - yradius.conf

This module give support to establish communication between Yate and FreeRADIUS, as well the ip address and port of the FreeRADIUS server. Are set the specific attributes to sent in the CDR message and are assigned the correct values.

[edit] Regexroute module - regexroute.conf

This module is used in addition to the register module, to assign values ​​of different parameters in the call as the error messages or the formats to use in transcoding calls, used to route calls without using database.

[edit] Register module - register.conf

The register module defines the messsage handlers which are communicating with the x164 database. Message handlers "catch" internal yate messages, issue queries to the database and return the result back to yate. x164 is configured to use mysql stored-procedures as message handlers.

[edit] Authuser

User_Auth is used to identify the subscriber.

PROCEDURE `proc_user_auth`( 
IN username VARCHAR(100),   // username received in SIP INVITE
IN domain VARCHAR(100),     // domain name from caller
IN address VARCHAR(25)      // IP address and port of the received call
IN password VARCHAR(25)     // secret key for MySQL procedures in Yate
)

Output:

- authname: subscriber in the Customers table.
- password (only in case of dynamic IP) : password for this subscriber.

[edit] Register

This query handle register messages, add in database data of register users and the last time that the user was registered.

PROCEDURE `proc_user_register`( 
IN ip_host VARCHAR(30),		// IP address received in SIP INVITE
IN ip_port INT,			// IP port received in SIP INVITE
IN expires INT,			// register expiration time
IN authname VARCHAR(125)	// authorized subscriber name corresponding in data base
IN password VARCHAR(25)		// secret key for MySQL procedures in Yate
)

Output: no output.

[edit] Unregister

This query handle unregister messages initializing the data entered by register message.

PROCEDURE `proc_user_unregister`(
IN authname VARCHAR(125)        // authorized subscriber name corresponding in data base
IN password VARCHAR(25)        // secret key for MySQL procedures in Yate
)

Output: no output.

[edit] Engine timer

The engine timer found that users have exceeded the time of registration and invalidate the dynamic_ip.

PROCEDURE `proc_enginer_timer`(
IN password VARCHAR(25)       // secret key for MySQL procedures in Yate
)

Output: no output.

[edit] Preroute

Preroute checks whether an incoming route for the combination of IP address and called number or authname and called number exists. The caller is either identified by IP address or was identified by authname/password combination in authname procedure. If no incoming route exists the call is blocked.

PROCEDURE `proc_get_preroute`( 
IN authname VARCHAR(125),     // authorized subscriber name corresponding in data base
IN address VARCHAR(25),       // IP address and port received in SIP INVITE
IN called VARCHAR(100)        // the called number, optionally with prefix
IN password VARCHAR(25)       // secret key for MySQL procedures in Yate
)

Output:

- username: caller's Subscriber in the Customers table.

- usernameSell: same as username.

- usernameNoBuy:  caller's Subscriber_out in the customers table.

- rtpproxy_in: flag indicating if the incoming leg supports RTP proxy.

- realRateSell: price per minute of the found incoming rate in the base currency.

- realConnecSell: connect cost of the found incoming rate in the base currency.

- rateIdSell: Id of the found incoming route.

- token: hash generated with the increase of the call counter. This token must be input to the proc_cdr_finalize procedure in order to decrease the counter when the call finishes.

[edit] Route

This selects the possible outgoing routes according to the incoming parameters, looking for the best quality and profit. Unprofitable routes are blocked.

PROCEDURE `proc_get_route`( 
IN usernameNobuy VARCHAR(125), // Subscriber_out found in incoming route to prevent call loops
IN rtproxy_in TINYINT(4),      // 0/1 flag to specify whether the rtp stream of the incoming call leg is proxied.
IN realRateSell FLOAT,         // (client) call rate found in preroute expressed in the base currency (EUR) 
IN called VARCHAR(100),        // Called number (optionally with prefix). The prefix is not used.
IN _format_in VARCHAR(255),    // Codecs received in incoming call leg
IN password VARCHAR(25)        // secret key for MySQL procedures in Yate
)

Output for DID destinations:

- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the subscriber in the Customers table that the called number is linked to.

- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.

- username: Suscriber field in the Customers table with prefix "did_".

- formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.


Output for other destinations:

- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the carrier in the Carries table that the route is linked to.

- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.

- username: Suscriber field in the Customers table with prefix "did_".  formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.

- rateIdBuy: Id of the found rate.

- expProfit: expected profit, calculated using the incoming and outgoing rates and connect costs and the Average Call Duration of the outgoing route.

[edit] Route V3

Selects the possible outgoing routes according to the incoming parameters. It also allows to select the routing method, set quality limits, and enable loss making calls.

PROCEDURE `proc_get_route_v3`( 
IN usernameNobuy VARCHAR(125),		// Subscriber_out found in incoming route to prevent call loops
IN rtproxy_in TINYINT(4),		// 0/1 flag to specify whether the rtp stream of the incoming call leg is proxied.
IN realRateSell DECIMAL(18,8),			// (client) call rate found in preroute expressed in the base currency (EUR) 
IN realconnectSell DECIMAL(18,8),       // (client) connect cost found in preroute expressed in the base currency (EUR) 
IN called VARCHAR(100),			// Called number (optionally with prefix). The prefix is not used.
IN _format_in VARCHAR(255),		// Codecs received in incoming call leg
IN password VARCHAR(25),		// secret key for MySQL procedures in Yate
IN routing VARCHAR(100),		// Routing method: 'least_cost', 'quality'. Default is profit based routing.
IN qACD INT,				// Minimum Average Call Duration. Routes below this limit are blocked.
IN qASR INT,				// Minimum Success Rate (successful calls/total calls). Routes below this limit are blocked. 
IN blocklosscalls TINYINT(4))		// 0/1 flag, blocks unprofitable calls when 1
)

Output for DID destinations:

- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the subscriber in the Customers table that the called number is linked to.

- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.

- username: Suscriber field in the Customers table with prefix "did_".

- formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.


Output for other destinations:

- location: Pre_location + called number + Post_location. Pre_location and Post_location are taken from the carrier in the Carries table that the route is linked to.

- rtp_forward: enable rtp_forward if neither the caller or the called subscribers support RTP proxying.

- username: Suscriber field in the Customers table with prefix "did_".  formats: formats sent in the invite message. These will be taken from the called subscriber unless it is empty and neither of the legs support RTP proxying.

- rateIdBuy: Id of the found rate.

- expProfit: expected profit, calculated using the incoming and outgoing rates and connect costs and the Average Call Duration of the outgoing route.

[edit] cdr_finalize

This procedure computes the values ​​of the call once finished to update the statistics in the system.

PROCEDURE `proc_cdr_finalize`( 
IN duration FLOAT,         // the overall call duration
IN billtime FLOAT,         // the time the call was connected
IN ringtime FLOAT,         // duration of call ringing
IN direction VARCHAR(10),  // incoming or outgoing
IN status VARCHAR(10),     // if the call was connected or not
IN rateidBuy BIGINT(20),   // id of the rate for the outgoing call leg
IN rateidSell BIGINT(20),  // id of the rate for the incoming call leg
IN password VARCHAR(25),   // secret key for MySQL procedures in Yate
IN token VARCHAR(32)       // decreases the call counter using the token given in proc_get_preroute
)

Output: no output.

[edit] RTP Channel module - yrtpchan.conf

This module provides RTP and udptl transports for any technology that requieres it as SIP or H.323. The RTCP support is disabled.

[edit] SIP Channel module - ysipchan.conf

This module give support to SIP protocol using the YASS library. Here also is posible select the value "expires" used in register.conf and the codecs enable to use.

[edit] Yate - yate.conf

In this configuration file is selected the modules that are in use, and the parameter "timeout" limits the call duration as 2h.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox