mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
more documentation and minor corrections
This commit is contained in:
@@ -34,9 +34,10 @@ var (
|
||||
direction = flag.String("direction", "OUT", "Call direction")
|
||||
tenant = flag.String("tenant", "vdf", "Tenant identificator")
|
||||
subject = flag.String("subject", "rif", "The client who made the call")
|
||||
dest = flag.String("dest", "0256", "Call destination")
|
||||
ts = flag.String("ts", "2012-02-09T00:00:00Z", "Time start")
|
||||
te = flag.String("te", "2012-02-09T00:10:00Z", "Time end")
|
||||
account = flag.String("account", "rif", "The the user balance to be used")
|
||||
dest = flag.String("dest", "041", "Call destination")
|
||||
start = flag.String("start", "2012-02-09T00:00:00Z", "Time start")
|
||||
end = flag.String("end", "2012-02-09T00:10:00Z", "Time end")
|
||||
amount = flag.Float64("amount", 100, "Amount for different operations")
|
||||
)
|
||||
|
||||
@@ -48,11 +49,11 @@ func main() {
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
timestart, err := time.Parse(time.RFC3339, *ts)
|
||||
timestart, err := time.Parse(time.RFC3339, *start)
|
||||
if err != nil {
|
||||
log.Fatal("Time start format is invalid: ", err)
|
||||
}
|
||||
timeend, err := time.Parse(time.RFC3339, *te)
|
||||
timeend, err := time.Parse(time.RFC3339, *end)
|
||||
if err != nil {
|
||||
log.Fatal("Time end format is invalid: ", err)
|
||||
}
|
||||
@@ -62,6 +63,7 @@ func main() {
|
||||
TOR: *tor,
|
||||
Tenant: *tenant,
|
||||
Subject: *subject,
|
||||
Account: *account,
|
||||
Destination: *dest,
|
||||
TimeStart: timestart,
|
||||
TimeEnd: timeend,
|
||||
@@ -99,7 +101,7 @@ func main() {
|
||||
if err = client.Call("Responder.DebitSeconds", cd, &result); err == nil {
|
||||
fmt.Println(result)
|
||||
}
|
||||
case "addvolumediscountseconds":
|
||||
/*case "addvolumediscountseconds":
|
||||
var result float64
|
||||
if err = client.Call("Responder.AddVolumeDiscountSeconds", cd, &result); err == nil {
|
||||
fmt.Println(result)
|
||||
@@ -113,7 +115,7 @@ func main() {
|
||||
var result float64
|
||||
if err = client.Call("Responder.AddRecievedCallSeconds", cd, &result); err == nil {
|
||||
fmt.Println(result)
|
||||
}
|
||||
}*/
|
||||
case "resetuserbudget":
|
||||
var result float64
|
||||
if err = client.Call("Responder.ResetUserBudget", cd, &result); err == nil {
|
||||
@@ -131,9 +133,9 @@ func main() {
|
||||
fmt.Println("\tdebitbalance")
|
||||
fmt.Println("\tdebitsms")
|
||||
fmt.Println("\tdebitseconds")
|
||||
fmt.Println("\taddvolumediscountseconds")
|
||||
fmt.Println("\tresetvolumediscountseconds")
|
||||
fmt.Println("\taddrecievedcallseconds")
|
||||
// fmt.Println("\taddvolumediscountseconds")
|
||||
// fmt.Println("\tresetvolumediscountseconds")
|
||||
// fmt.Println("\taddrecievedcallseconds")
|
||||
fmt.Println("\tresetuserbudget")
|
||||
fmt.Println("\tstatus")
|
||||
flag.PrintDefaults()
|
||||
|
||||
@@ -33,18 +33,18 @@ var (
|
||||
redisdb = flag.Int("redisdb", 10, "redis database number (10)")
|
||||
redispass = flag.String("pass", "", "redis database password")
|
||||
flush = flag.Bool("flush", false, "Flush the database before importing")
|
||||
monthsFn = flag.String("month", "Months.csv", "Months file")
|
||||
monthdaysFn = flag.String("monthdays", "MonthDays.csv", "Month days file")
|
||||
weekdaysFn = flag.String("weekdays", "WeekDays.csv", "Week days file")
|
||||
destinationsFn = flag.String("destinations", "Destinations.csv", "Destinations file")
|
||||
ratesFn = flag.String("rates", "Rates.csv", "Rates file")
|
||||
timingsFn = flag.String("timings", "Timings.csv", "Timings file")
|
||||
ratetimingsFn = flag.String("ratetimings", "RateTimings.csv", "Rates timings file")
|
||||
ratingprofilesFn = flag.String("ratingprofiles", "RatingProfiles.csv", "Rating profiles file")
|
||||
actionsFn = flag.String("actions", "Actions.csv", "Actions file")
|
||||
actiontimingsFn = flag.String("actiontimings", "ActionTimings.csv", "Actions timings file")
|
||||
actiontriggersFn = flag.String("actiontriggers", "ActionTriggers.csv", "Actions triggers file")
|
||||
accountactionsFn = flag.String("accountactions", "AccountActions.csv", "Account actions file")
|
||||
monthsFn = flag.String("month", "", "Months file")
|
||||
monthdaysFn = flag.String("monthdays", "", "Month days file")
|
||||
weekdaysFn = flag.String("weekdays", "", "Week days file")
|
||||
destinationsFn = flag.String("destinations", "", "Destinations file")
|
||||
ratesFn = flag.String("rates", "", "Rates file")
|
||||
timingsFn = flag.String("timings", "", "Timings file")
|
||||
ratetimingsFn = flag.String("ratetimings", "", "Rates timings file")
|
||||
ratingprofilesFn = flag.String("ratingprofiles", "", "Rating profiles file")
|
||||
actionsFn = flag.String("actions", "", "Actions file")
|
||||
actiontimingsFn = flag.String("actiontimings", "", "Actions timings file")
|
||||
actiontriggersFn = flag.String("actiontriggers", "", "Actions triggers file")
|
||||
accountactionsFn = flag.String("accountactions", "", "Account actions file")
|
||||
sep rune
|
||||
)
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
var (
|
||||
cdrFile = flag.String("freeswitchcdr", "Master.csv", "Freeswitch Master CSV CDR file.")
|
||||
resultFile = flag.String("resultfile", "out.csv", "Generated file containing CDR and price info.")
|
||||
host = flag.String("host", "localhost", "The host to connect to. Values that start with / are for unix domain sockets.")
|
||||
host = flag.String("host", "localhost", "The host to connect to. Values that start with / are for UNIX domain sockets.")
|
||||
port = flag.String("port", "5432", "The port to bind to.")
|
||||
dbName = flag.String("dbname", "cgrates", "The name of the database to connect to.")
|
||||
user = flag.String("user", "", "The user to sign in as.")
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
separator = flag.String("separator", ",", "Default field separator")
|
||||
redisserver = flag.String("redisserver", "127.0.0.1:6379", "redis server address (tcp:127.0.0.1:6379)")
|
||||
redisdb = flag.Int("rdb", 10, "redis database number (10)")
|
||||
redispass = flag.String("pass", "", "redis database password")
|
||||
|
||||
@@ -114,13 +114,13 @@ Destinations
|
||||
|
||||
The destinations are binding together various prefixes / caller ids to define a logical destination group. A prefix can appear in multiple destination groups.
|
||||
|
||||
+------------+-------+
|
||||
| Tag | Prefix|
|
||||
+============+=======+
|
||||
| GERMANY | 49 |
|
||||
+------------+-------+
|
||||
| GERMANY_O2 | 49176 |
|
||||
+------------+-------+
|
||||
+------------+--------+
|
||||
| Tag | Prefix |
|
||||
+============+========+
|
||||
| GERMANY | 49 |
|
||||
+------------+--------+
|
||||
| GERMANY_O2 | 49176 |
|
||||
+------------+--------+
|
||||
|
||||
Tag
|
||||
A string by witch this destination will be referenced in other places by.
|
||||
|
||||
@@ -31,7 +31,7 @@ This will install the sources and compile all available tools
|
||||
Running
|
||||
-------
|
||||
|
||||
There are only three main command to used with CGRateS:
|
||||
The CGRateS suite is formed by seven tools described bellow.
|
||||
|
||||
cgr-balancer
|
||||
~~~~~~~~~~~~
|
||||
@@ -40,6 +40,7 @@ The cgr-balancer will open a JSON RPC server and an HTTP server ready for taking
|
||||
|
||||
rif@grace:~$ cgr-balancer --help
|
||||
Usage of cgr-balancer:
|
||||
-freeswitch=false: connect to freeswitch server
|
||||
-freeswitchpass="ClueCon": freeswitch address host:port
|
||||
-freeswitchsrv="localhost:8021": freeswitch address host:port
|
||||
-httpapiaddr="127.0.0.1:8000": Http API server address (localhost:2002)
|
||||
@@ -47,10 +48,11 @@ The cgr-balancer will open a JSON RPC server and an HTTP server ready for taking
|
||||
-jsonrpcaddr="127.0.0.1:2001": Json RPC server address (localhost:2001)
|
||||
-rateraddr="127.0.0.1:2000": Rater server address (localhost:2000)
|
||||
|
||||
:Example: cgr-balancer -freeswitch=true -httpapiaddr=127.0.0.1:6060 -json=true
|
||||
|
||||
cgr-rater
|
||||
~~~~~~~~~
|
||||
The cgr-rater can be provided with the balancer server address and can be configured to listen to a specific interface and port.
|
||||
The cgr-rater can be provided with the balancer server address and can be configured to listen to a specific interface and port. It is an auxiliary tool only and is meant to be used for housekeeping duties (better alternative to curl inspection).
|
||||
::
|
||||
|
||||
rif@grace:~$ cgr-rater --help
|
||||
@@ -65,50 +67,69 @@ The cgr-rater can be provided with the balancer server address and can be config
|
||||
-redissrv="127.0.0.1:6379": redis address host:port
|
||||
-standalone=false: start standalone server (no balancer)
|
||||
|
||||
:Example: cgr-rater -balancer=127.0.0.1:2000
|
||||
|
||||
cgr-console
|
||||
~~~~~~~~~~~
|
||||
The cgr-console is a command line tool used to access the balancer (or the rater directly) to call all the API methods offered by CGRateS.
|
||||
The cgr-console is a command line tool used to access the balancer (or the rater directly) to call all the API methods offered by CGRateS. It is
|
||||
::
|
||||
|
||||
rif@grace:~$ cgr-console --help
|
||||
Usage of cgr-console:
|
||||
rif@grace:~$ cgr-console
|
||||
List of commands:
|
||||
getcost
|
||||
getmaxsessiontime
|
||||
debitbalance
|
||||
debitsms
|
||||
debitseconds
|
||||
resetuserbudget
|
||||
status
|
||||
-direction="OUT": Call direction
|
||||
-tenant="vdf": Tenant identificator
|
||||
-tor="0": Type of record
|
||||
-amount=100: Amount for different operations
|
||||
-balancer="127.0.0.1:2001": balancer address host:port
|
||||
-cstmid="vdf": Customer identification
|
||||
-dest="0256": Destination prefix
|
||||
-dest="041": Call destination
|
||||
-server="127.0.0.1:2001": server address host:port
|
||||
-subject="rif": The client who made the call
|
||||
-te="2012-02-09T00:10:00Z": Time end
|
||||
-tor=0: Type of record
|
||||
-ts="2012-02-09T00:00:00Z": Time start
|
||||
-account="rif": The the user balance to be used
|
||||
-start="2012-02-09T00:00:00Z": Time start
|
||||
-end="2012-02-09T00:10:00Z": Time end
|
||||
|
||||
:Example: cgr-console getcost -subject=rif -dest=0723045326 -start=2012-07-13T15:38:00Z -end=2012-07-13T15:39:00Z
|
||||
|
||||
cgr-loader
|
||||
~~~~~~~~~~
|
||||
|
||||
This tool is used for importing the data from CSV files into the CGRateS database system. The structure of the CSV files is described in the :ref:`data-importing` chapter.
|
||||
|
||||
::
|
||||
|
||||
rif@grace:~$ cgr-loader --help
|
||||
Usage of cgr-loader:
|
||||
-accountactions="AccountActions.csv": Account actions file
|
||||
-actions="Actions.csv": Actions file
|
||||
-actiontimings="ActionTimings.csv": Actions timings file
|
||||
-actiontriggers="ActionTriggers.csv": Actions triggers file
|
||||
-destinations="Destinations.csv": Destinations file
|
||||
-accountactions="": Account actions file
|
||||
-actions="": Actions file
|
||||
-actiontimings="": Actions timings file
|
||||
-actiontriggers="": Actions triggers file
|
||||
-destinations="": Destinations file
|
||||
-flush=false: Flush the database before importing
|
||||
-month="Months.csv": Months file
|
||||
-monthdays="MonthDays.csv": Month days file
|
||||
-month="": Months file
|
||||
-monthdays="": Month days file
|
||||
-pass="": redis database password
|
||||
-rates="Rates.csv": Rates file
|
||||
-ratetimings="RateTimings.csv": Rates timings file
|
||||
-ratingprofiles="RatingProfiles.csv": Rating profiles file
|
||||
-rdb=10: redis database number (10)
|
||||
-redisserver="127.0.0.1:6379": redis server address (tcp:127.0.0.1:6379)
|
||||
-rates="": Rates file
|
||||
-ratetimings="": Rates timings file
|
||||
-ratingprofiles="": Rating profiles file
|
||||
-redisdb=10: redis database number (10)
|
||||
-redissrv="127.0.0.1:6379": redis server address (tcp:127.0.0.1:6379)
|
||||
-separator=",": Default field separator
|
||||
-timings="Timings.csv": Timings file
|
||||
-weekdays="WeekDays.csv": Week days file
|
||||
-timings="": Timings file
|
||||
-weekdays="": Week days file
|
||||
|
||||
:Example: cgr-loader -destinations=Destinations.csv
|
||||
|
||||
cgr-sessionmanager
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Session manager connects and monitors the freeswitch server issuing API request to other CGRateS components. It can run in standalone mode for minimal system configuration.
|
||||
|
||||
::
|
||||
|
||||
rif@grace:~$ cgr-sessionmanager --help
|
||||
@@ -121,31 +142,50 @@ cgr-sessionmanager
|
||||
-redissrv="127.0.0.1:6379": redis address host:port
|
||||
-standalone=false: run standalone (run as a rater)
|
||||
|
||||
:Example: cgr-sessionmanager -standalone=true
|
||||
|
||||
cgr-mediator
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The mediator parses the CDR file and writes the calls cost to a postgress database.
|
||||
|
||||
The structure of the table (as an SQL command) is the following::
|
||||
|
||||
CREATE TABLE callcosts (
|
||||
uuid varchar(80) primary key,direction varchar(32),
|
||||
tenant varchar(32),tor varchar(32),
|
||||
subject varchar(32),
|
||||
destination varchar(32),
|
||||
cost real,
|
||||
conect_fee real,
|
||||
timespans text
|
||||
);
|
||||
|
||||
::
|
||||
|
||||
rif@grace:~$ cgr-mediator --help
|
||||
Usage of cgr-mediator:
|
||||
-dbname="cgrates": The name of the database to connect to.
|
||||
-freeswitchcdr="Master.csv": Freeswitch Master CSV CDR file.
|
||||
-host="localhost": The host to connect to. Values that start with / are for unix domain sockets.
|
||||
-host="localhost": The host to connect to. Values that start with / are for UNIX domain sockets.
|
||||
-password="": The user's password.
|
||||
-port="5432": The port to bind to.
|
||||
-resultfile="out.csv": Generated file containing CDR and price info.
|
||||
-user="": The user to sign in as.
|
||||
|
||||
:Example: cgr-mediator -freeswitchcdr="logs.csv"
|
||||
|
||||
cgr-scheduler
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The scheduler is loading the timed actions form database and executes them as appropriate, It will execute all run once actions as they are loaded. It will reload all the action timings from the database when it received system HUP signal (pkill -1 cgr-schedule).
|
||||
|
||||
::
|
||||
|
||||
rif@grace:~$ cgr-balancer --help
|
||||
Usage of cgr-balancer:
|
||||
-freeswitchpass="ClueCon": freeswitch address host:port
|
||||
-freeswitchsrv="localhost:8021": freeswitch address host:port
|
||||
-httpapiaddr="127.0.0.1:8000": Http API server address (localhost:2002)
|
||||
-json=false: use JSON for RPC encoding
|
||||
-jsonrpcaddr="127.0.0.1:2001": Json RPC server address (localhost:2001)
|
||||
-rateraddr="127.0.0.1:2000": Rater server address (localhost:2000)
|
||||
rif@grace:~$ cgr-scheduler --help
|
||||
Usage of cgr-scheduler:
|
||||
-pass="": redis database password
|
||||
-rdb=10: redis database number (10)
|
||||
-redisserver="127.0.0.1:6379": redis server address (tcp:127.0.0.1:6379)
|
||||
|
||||
:Example: cgr-scheduler -rdb=2 -pass="secret"
|
||||
Reference in New Issue
Block a user