new un-park command

This commit is contained in:
Radu Ioan Fericean
2012-09-19 14:10:17 +03:00
parent 3962f4bb26
commit 3d4d02a23b
3 changed files with 7 additions and 8 deletions

View File

@@ -131,9 +131,8 @@ func (sm *FSSessionManager) DisconnectSession(s *Session) {
}
// Sends the transfer command to unpark the call to freeswitch
func (sm *FSSessionManager) UnparkCall(uuid, call_dest_nb, reply string) {
fmt.Fprint(sm.conn, fmt.Sprintf("api uuid_setvar %s cgr_notify %s\n\n", uuid, reply))
fmt.Fprint(sm.conn, fmt.Sprintf("api uuid_transfer %s %s\n\n", uuid, call_dest_nb))
func (sm *FSSessionManager) UnparkCall(uuid, reply string) {
fmt.Fprint(sm.conn, fmt.Sprintf("api uuid_transfer %s 'set:cgr_notify=%s' inline\n\n", uuid, reply))
}
// Called on freeswitch's hearbeat event

View File

@@ -46,7 +46,7 @@ func (rsd *SessionDelegate) OnChannelPark(ev Event, sm SessionManager) {
return
}
if ev.MissingParameter() {
sm.UnparkCall(ev.GetUUID(), ev.GetCallDestNb(), MISSING_PARAMETER)
sm.UnparkCall(ev.GetUUID(), MISSING_PARAMETER)
}
cd := timespans.CallDescriptor{
Direction: ev.GetDirection(),
@@ -60,15 +60,15 @@ func (rsd *SessionDelegate) OnChannelPark(ev Event, sm SessionManager) {
err = rsd.Connector.GetMaxSessionTime(cd, &remainingSeconds)
if err != nil {
timespans.Logger.Err(fmt.Sprintf("Could not get max session time for %v: %v", ev.GetUUID(), err))
sm.UnparkCall(ev.GetUUID(), ev.GetCallDestNb(), SYSTEM_ERROR)
sm.UnparkCall(ev.GetUUID(), SYSTEM_ERROR)
return
}
if remainingSeconds == 0 {
timespans.Logger.Info(fmt.Sprintf("Not enough credit for trasferring the call %v.", ev.GetUUID()))
sm.UnparkCall(ev.GetUUID(), ev.GetCallDestNb(), INSUFFICIENT_FUNDS)
sm.UnparkCall(ev.GetUUID(), INSUFFICIENT_FUNDS)
return
}
sm.UnparkCall(ev.GetUUID(), ev.GetCallDestNb(), AUTH_OK)
sm.UnparkCall(ev.GetUUID(), AUTH_OK)
}
func (rsd *SessionDelegate) OnChannelAnswer(ev Event, s *Session) {

View File

@@ -24,7 +24,7 @@ import (
type SessionManager interface {
DisconnectSession(*Session)
UnparkCall(string, string, string)
UnparkCall(string, string)
GetSessionDelegate() *SessionDelegate
GetDbLogger() timespans.DataStorage
}