mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added mediator and session manager to the mix
This commit is contained in:
@@ -192,5 +192,13 @@ func main() {
|
||||
}()
|
||||
}
|
||||
|
||||
if sm_enabled {
|
||||
go startSessionManager()
|
||||
}
|
||||
|
||||
if mediator_enabled {
|
||||
go startMediator()
|
||||
}
|
||||
|
||||
<-exitChan
|
||||
}
|
||||
|
||||
@@ -32,16 +32,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
/*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.")
|
||||
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.")
|
||||
password = flag.String("password", "", "The user's password.")
|
||||
)*/
|
||||
|
||||
func readDbRecord(db *sql.DB, searchedUUID string) (cc *timespans.CallCost, timespansText string, err error) {
|
||||
row := db.QueryRow(fmt.Sprintf("SELECT * FROM callcosts WHERE uuid='%s'", searchedUUID))
|
||||
var uuid string
|
||||
@@ -50,7 +40,7 @@ func readDbRecord(db *sql.DB, searchedUUID string) (cc *timespans.CallCost, time
|
||||
return
|
||||
}
|
||||
|
||||
func maina() {
|
||||
func startMediator() {
|
||||
flag.Parse()
|
||||
useDB := true
|
||||
file, err := os.Open(mediator_cdr_file)
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"net/rpc/jsonrpc"
|
||||
)
|
||||
|
||||
func mainc() {
|
||||
func startSessionManager() {
|
||||
flag.Parse()
|
||||
sm := &sessionmanager.FSSessionManager{}
|
||||
getter, err := timespans.NewRedisStorage(redis_server, redis_db)
|
||||
@@ -49,7 +49,4 @@ func mainc() {
|
||||
}
|
||||
sm.Connect(sessionmanager.NewRPCClientSessionDelegate(client), sm_freeswitch_server, sm_freeswitch_pass)
|
||||
}
|
||||
waitChan := make(<-chan byte)
|
||||
log.Print("CGRateS is listening!")
|
||||
<-waitChan
|
||||
}
|
||||
|
||||
@@ -19,30 +19,34 @@ redis_server = 127.0.0.1:6379 #redis address host:port
|
||||
redis_db = 10 # redis database number
|
||||
|
||||
[rater]
|
||||
standalone = true # start standalone server (no balancer)
|
||||
standalone = false # start standalone server (no balancer)
|
||||
balancer_server = 127.0.0.1:2000 # balancer address host:port
|
||||
listen_api = 127.0.0.1:1234 # listening address host:port
|
||||
json = false # use JSON for RPC encoding
|
||||
|
||||
[balancer]
|
||||
enabled = false
|
||||
standalone = false # run standalone
|
||||
enabled = true
|
||||
standalone = true # run standalone
|
||||
listen_rater = 127.0.0.1:2000 # Rater server address
|
||||
listen_api = 127.0.0.1:2001 # Json RPC server address
|
||||
web_status_server = 127.0.0.1:8000 # Web server address (for status)
|
||||
json = false # use JSON for RPC encoding
|
||||
ON for RPC encoding
|
||||
|
||||
[scheduler]
|
||||
enabled = true
|
||||
json = false # use JSON for RPC encoding
|
||||
|
||||
[session_manager]
|
||||
enabled = false
|
||||
standalone = false # run standalone
|
||||
enabled = true
|
||||
standalone = true # run standalone
|
||||
api_server = 127.0.0.1:2000 # balancer address host:port
|
||||
freeswitch_server = localhost:8021 # freeswitch address host:port
|
||||
freeswitch_pass = ClueCon # freeswitch address host:port
|
||||
json = false # use JSON for RPC encoding
|
||||
|
||||
[mediator]
|
||||
enabled = false
|
||||
enabled = false
|
||||
standalone = false # run standalone
|
||||
cdr_file = Master.csv # Freeswitch Master CSV CDR file.
|
||||
result_file = out.csv # Generated file containing CDR and price info.
|
||||
|
||||
Reference in New Issue
Block a user