correction of call direction

This commit is contained in:
Radu Ioan Fericean
2012-08-10 14:18:03 +03:00
parent 05dd21c005
commit 9e92446d88
5 changed files with 24 additions and 17 deletions

View File

@@ -36,19 +36,19 @@ var (
const (
// Freswitch event proprities names
CALL_DIRECTION = "Call-Direction"
ORIG_ID = "variable_sip_call_id" //- originator_id - match cdrs
SUBJECT = "variable_cgr_subject"
ACCOUNT = "variable_cgr_account"
DESTINATION = "variable_cgr_destination"
TOR = "variable_cgr_tor"
UUID = "Unique-ID" // -Unique ID for this call leg
CSTMID = "variable_cgr_cstmid"
START_TIME = "Event-Date-GMT"
NAME = "Event-Name"
HEARTBEAT = "HEARTBEAT"
ANSWER = "CHANNEL_ANSWER"
HANGUP = "CHANNEL_HANGUP_COMPLETE"
DIRECTION = "Call-Direction"
ORIG_ID = "variable_sip_call_id" //- originator_id - match cdrs
SUBJECT = "variable_cgr_subject"
ACCOUNT = "variable_cgr_account"
DESTINATION = "variable_cgr_destination"
TOR = "variable_cgr_tor"
UUID = "Unique-ID" // -Unique ID for this call leg
CSTMID = "variable_cgr_cstmid"
START_TIME = "Event-Date-GMT"
NAME = "Event-Name"
HEARTBEAT = "HEARTBEAT"
ANSWER = "CHANNEL_ANSWER"
HANGUP = "CHANNEL_HANGUP_COMPLETE"
)
// Nice printing for the event object.
@@ -78,7 +78,9 @@ func (fsev *FSEvent) GetName() string {
return fsev.Fields[NAME]
}
func (fsev *FSEvent) GetDirection() string {
return fsev.Fields[CALL_DIRECTION]
//TODO: temporary hack
return "OUT"
//return fsev.Fields[DIRECTION]
}
func (fsev *FSEvent) GetOrigId() string {
return fsev.Fields[ORIG_ID]

View File

@@ -65,7 +65,9 @@ func (sm *FSSessionManager) Connect(ed *SessionDelegate, address, pass string) e
sm.conn = conn
sm.buf = bufio.NewReaderSize(conn, 8192)
fmt.Fprint(conn, fmt.Sprintf("auth %s\n\n", pass))
fmt.Fprint(conn, "event json all\n\n")
fmt.Fprint(conn, "event json HEARTBEAT CHANNEL_ANSWER CHANNEL_HANGUP_COMPLETE\n\n")
fmt.Fprint(conn, "filter Call-Direction inbound\n\n")
fmt.Fprint(conn, "filter Event-Name HEARTBEAT\n\n")
go func() {
sm.delayFunc = fib()
exitChan := make(chan bool)

View File

@@ -40,7 +40,7 @@ func (psl *PostgresLogger) Log(uuid string, cc *timespans.CallCost) {
}
_, err = psl.Db.Exec(fmt.Sprintf("INSERT INTO cdr VALUES ('%s','%s', '%s', '%s', '%s', '%s', '%s', %v, %v, '%s')",
uuid,
cc.Destination,
cc.Direction,
cc.Tenant,
cc.TOR,
cc.Subject,

View File

@@ -128,6 +128,7 @@ func (rsd *SessionDelegate) OnChannelHangupComplete(ev Event, s *Session) {
}
if seconds > 0 {
cd := &timespans.CallDescriptor{
Direction: lastCC.Direction,
TOR: lastCC.TOR,
Tenant: lastCC.Tenant,
Subject: lastCC.Subject,

View File

@@ -276,7 +276,9 @@ func (cd *CallDescriptor) GetCost() (*CallCost, error) {
}
cost += ts.getCost(cd)
}
cc := &CallCost{TOR: cd.TOR,
cc := &CallCost{
Direction: cd.Direction,
TOR: cd.TOR,
Tenant: cd.Tenant,
Subject: cd.Subject,
Account: cd.Account,