diff --git a/sessionmanager/fsevent.go b/sessionmanager/fsevent.go index da11912bd..4ae1e889b 100644 --- a/sessionmanager/fsevent.go +++ b/sessionmanager/fsevent.go @@ -69,6 +69,7 @@ const ( HANGUP_CAUSE = "Hangup-Cause" PDD_MEDIA_MS = "variable_progress_mediamsec" PDD_NOMEDIA_MS = "variable_progressmsec" + IGNOREPARK = "variable_cgr_ignorepark" VAR_CGR_DISCONNECT_CAUSE = "variable_" + utils.CGR_DISCONNECT_CAUSE ) diff --git a/sessionmanager/fssessionmanager.go b/sessionmanager/fssessionmanager.go index 6db569dc6..e337ef1f9 100644 --- a/sessionmanager/fssessionmanager.go +++ b/sessionmanager/fssessionmanager.go @@ -191,19 +191,9 @@ func (sm *FSSessionManager) setCgrLcr(ev engine.Event, connId string) error { return nil } -// Sends the transfer command to unpark the call to freeswitch -func (sm *FSSessionManager) unparkCall(uuid, connId, call_dest_nb, notify string) { - _, err := sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_setvar %s cgr_notify %s\n\n", uuid, notify)) - if err != nil { - engine.Logger.Err(fmt.Sprintf(" Could not send unpark api notification to freeswitch, error: <%s>, connId: %s", err.Error(), connId)) - } - if _, err = sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_transfer %s %s\n\n", uuid, call_dest_nb)); err != nil { - engine.Logger.Err(fmt.Sprintf(" Could not send unpark api call to freeswitch, error: <%s>, connId: %s", err.Error(), connId)) - } -} - func (sm *FSSessionManager) onChannelPark(ev engine.Event, connId string) { - if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE { // Do not process this request + fsev := ev.(FSEvent) + if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE || fsev[IGNOREPARK] == "true" { // Do not process this request return } var maxCallDuration float64 // This will be the maximum duration this channel will be allowed to last @@ -229,6 +219,17 @@ func (sm *FSSessionManager) onChannelPark(ev engine.Event, connId string) { sm.unparkCall(ev.GetUUID(), connId, ev.GetCallDestNr(utils.META_DEFAULT), AUTH_OK) } +// Sends the transfer command to unpark the call to freeswitch +func (sm *FSSessionManager) unparkCall(uuid, connId, call_dest_nb, notify string) { + _, err := sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_setvar %s cgr_notify %s\n\n", uuid, notify)) + if err != nil { + engine.Logger.Err(fmt.Sprintf(" Could not send unpark api notification to freeswitch, error: <%s>, connId: %s", err.Error(), connId)) + } + if _, err = sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_transfer %s %s\n\n", uuid, call_dest_nb)); err != nil { + engine.Logger.Err(fmt.Sprintf(" Could not send unpark api call to freeswitch, error: <%s>, connId: %s", err.Error(), connId)) + } +} + func (sm *FSSessionManager) onChannelAnswer(ev engine.Event, connId string) { if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE { // Do not process this request return