mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
better call descriptor parameters
This commit is contained in:
@@ -3,29 +3,27 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"github.com/rif/cgrates/timespans"
|
||||
"log"
|
||||
"log"
|
||||
"net/rpc/jsonrpc"
|
||||
"time"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
balancer = flag.String("balancer", "127.0.0.1:2001", "balancer address host:port")
|
||||
tor = flag.Int("tor", 0, "Type of record")
|
||||
cstmid = flag.String("cstmid", "vdf", "Customer identificator")
|
||||
subject = flag.String("subject", "rif", "The client who made the call")
|
||||
dest = flag.String("dest", "0256", "Destination prefix")
|
||||
ts = flag.String("ts", "2012-02-09T00:00:00Z", "Time start")
|
||||
te = flag.String("te", "2012-02-09T00:10:00Z", "Time end")
|
||||
tor = flag.Int("tor", 0, "Type of record")
|
||||
cstmid = flag.String("cstmid", "vdf", "Customer identificator")
|
||||
subject = flag.String("subject", "rif", "The client who made the call")
|
||||
dest = flag.String("dest", "0256", "Destination prefix")
|
||||
ts = flag.String("ts", "2012-02-09T00:00:00Z", "Time start")
|
||||
te = flag.String("te", "2012-02-09T00:10:00Z", "Time end")
|
||||
)
|
||||
|
||||
|
||||
|
||||
func main(){
|
||||
func main() {
|
||||
flag.Parse()
|
||||
client, _ := jsonrpc.Dial("tcp", "localhost:2001")
|
||||
defer client.Close()
|
||||
|
||||
|
||||
var err error
|
||||
timestart, err := time.Parse(time.RFC3339, *ts)
|
||||
if err != nil {
|
||||
@@ -37,19 +35,19 @@ func main(){
|
||||
}
|
||||
|
||||
cd := ×pans.CallDescriptor{TOR: *tor,
|
||||
CstmId: *cstmid,
|
||||
Subject: *subject,
|
||||
CstmId: *cstmid,
|
||||
Subject: *subject,
|
||||
DestinationPrefix: *dest,
|
||||
TimeStart: timestart,
|
||||
TimeEnd: timeend,
|
||||
TimeStart: timestart,
|
||||
TimeEnd: timeend,
|
||||
}
|
||||
result := timespans.CallCost{}
|
||||
result := timespans.CallCost{}
|
||||
|
||||
switch flag.Arg(0) {
|
||||
case "getcost":
|
||||
case "getcost":
|
||||
if err = client.Call("Responder.GetCost", cd, &result); err == nil {
|
||||
log.Print(result)
|
||||
}
|
||||
}
|
||||
default:
|
||||
log.Print("hello!")
|
||||
}
|
||||
@@ -58,4 +56,3 @@ func main(){
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user