diff --git a/agents/astagent.go b/agents/astagent.go index 8329a4715..460af0de6 100644 --- a/agents/astagent.go +++ b/agents/astagent.go @@ -365,7 +365,7 @@ func (sma *AsteriskAgent) V1GetActiveSessionIDs(ignParam string, } -// V1SendRAR is used to implement the sessions.BiRPClient interface -func (*AsteriskAgent) V1SendRAR(originID string, reply *string) (err error) { +// V1ReAuthorize is used to implement the sessions.BiRPClient interface +func (*AsteriskAgent) V1ReAuthorize(originID string, reply *string) (err error) { return utils.ErrNotImplemented } diff --git a/agents/diam_it_test.go b/agents/diam_it_test.go index 1a2dfc478..9335290b7 100644 --- a/agents/diam_it_test.go +++ b/agents/diam_it_test.go @@ -1031,7 +1031,7 @@ func testDiamItRAR(t *testing.T) { wait.Add(1) go func() { var reply string - if err := apierRpc.Call(utils.SessionSv1SendRAR, nil, &reply); err != nil { + if err := apierRpc.Call(utils.SessionSv1ReAuthorize, nil, &reply); err != nil { t.Error(err) } wait.Done() diff --git a/agents/diamagent.go b/agents/diamagent.go index 6c66621e3..dc8103dcc 100644 --- a/agents/diamagent.go +++ b/agents/diamagent.go @@ -447,13 +447,16 @@ func (da *DiameterAgent) V1DisconnectSession(args utils.AttrDisconnectSession, r return utils.ErrMandatoryIeMissing } originID := ssID.(string) - switch da.cgrCfg.DiameterAgentCfg().DisconnectMethod { + switch da.cgrCfg.DiameterAgentCfg().ForcedDisconnect { + case utils.META_NONE: + *reply = utils.OK + return case utils.MetaASR: return da.sendASR(originID, reply) case utils.MetaRAR: - return da.V1SendRAR(originID, reply) + return da.V1ReAuthorize(originID, reply) default: - return fmt.Errorf("Unsupported request type <%s>", da.cgrCfg.DiameterAgentCfg().DisconnectMethod) + return fmt.Errorf("Unsupported request type <%s>", da.cgrCfg.DiameterAgentCfg().ForcedDisconnect) } } @@ -502,8 +505,8 @@ func (da *DiameterAgent) sendASR(originID string, reply *string) (err error) { return } -// V1SendRAR sends a rar meseage to diameter client -func (da *DiameterAgent) V1SendRAR(originID string, reply *string) (err error) { +// V1ReAuthorize sends a rar meseage to diameter client +func (da *DiameterAgent) V1ReAuthorize(originID string, reply *string) (err error) { if originID == "" { utils.Logger.Info( fmt.Sprintf("<%s> cannot send RAR, missing session ID", diff --git a/agents/fsagent.go b/agents/fsagent.go index 6f0a67e0d..00832f9ac 100644 --- a/agents/fsagent.go +++ b/agents/fsagent.go @@ -440,7 +440,7 @@ func (sm *FSsessions) Reload() { sm.senderPools = make([]*fsock.FSockPool, len(sm.cfg.EventSocketConns)) } -// V1SendRAR is used to implement the sessions.BiRPClient interface -func (*FSsessions) V1SendRAR(originID string, reply *string) (err error) { +// V1ReAuthorize is used to implement the sessions.BiRPClient interface +func (*FSsessions) V1ReAuthorize(originID string, reply *string) (err error) { return utils.ErrNotImplemented } diff --git a/agents/kamagent.go b/agents/kamagent.go index f7627ec81..533fe2f07 100644 --- a/agents/kamagent.go +++ b/agents/kamagent.go @@ -424,7 +424,7 @@ func (ka *KamailioAgent) Reload() { ka.conns = make([]*kamevapi.KamEvapi, len(ka.cfg.EvapiConns)) } -// V1SendRAR is used to implement the sessions.BiRPClient interface -func (*KamailioAgent) V1SendRAR(originID string, reply *string) (err error) { +// V1ReAuthorize is used to implement the sessions.BiRPClient interface +func (*KamailioAgent) V1ReAuthorize(originID string, reply *string) (err error) { return utils.ErrNotImplemented } diff --git a/apier/v1/sessions.go b/apier/v1/sessions.go index a456fe734..586cdf647 100644 --- a/apier/v1/sessions.go +++ b/apier/v1/sessions.go @@ -142,7 +142,7 @@ func (ssv1 *SessionSv1) Call(serviceMethod string, return utils.APIerRPCCall(ssv1, serviceMethod, args, reply) } -// SendRAR sends the RAR for filterd sessions -func (smgv1 *SessionSv1) SendRAR(args *utils.SessionFilter, reply *string) error { - return smgv1.Ss.BiRPCv1SendRAR(nil, args, reply) +// ReAuthorize sends the RAR for filterd sessions +func (ssv1 *SessionSv1) ReAuthorize(args *utils.SessionFilter, reply *string) error { + return ssv1.Ss.BiRPCv1ReAuthorize(nil, args, reply) } diff --git a/apier/v1/sessionsbirpc.go b/apier/v1/sessionsbirpc.go index fb44b55b9..7d4fd5dba 100644 --- a/apier/v1/sessionsbirpc.go +++ b/apier/v1/sessionsbirpc.go @@ -53,7 +53,7 @@ func (ssv1 *SessionSv1) Handlers() map[string]interface{} { utils.SessionSv1ActivateSessions: ssv1.BiRPCv1ActivateSessions, utils.SessionSv1DeactivateSessions: ssv1.BiRPCv1DeactivateSessions, - utils.SessionSv1SendRAR: ssv1.BiRPCV1SendRAR, + utils.SessionSv1ReAuthorize: ssv1.BiRPCV1ReAuthorize, } } @@ -165,8 +165,8 @@ func (ssv1 *SessionSv1) BiRPCv1DeactivateSessions(clnt *rpc2.Client, return ssv1.Ss.BiRPCv1DeactivateSessions(clnt, args, reply) } -// BiRPCV1SendRAR sends the RAR for filterd sessions -func (ssv1 *SessionSv1) BiRPCV1SendRAR(clnt *rpc2.Client, +// BiRPCV1ReAuthorize sends the RAR for filterd sessions +func (ssv1 *SessionSv1) BiRPCV1ReAuthorize(clnt *rpc2.Client, args *utils.SessionFilter, reply *string) error { - return ssv1.Ss.BiRPCv1SendRAR(clnt, args, reply) + return ssv1.Ss.BiRPCv1ReAuthorize(clnt, args, reply) } diff --git a/config/config_defaults.go b/config/config_defaults.go index 04cd3f8ed..0bfae6b15 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -416,7 +416,7 @@ const CGRATES_CFG_JSON = ` "synced_conn_requests": false, // process one request at the time per connection "asr_template": "", // enable AbortSession message being sent to client on DisconnectSession "rar_template": "", // template used to build the Re-Auth-Request - "disconnect_method": "*asr", // the request to send to diameter on DisconnectSession <*asr|*rar> + "forced_disconnect": "*none", // the request to send to diameter on DisconnectSession <*none|*asr|*rar> "templates":{ // default message templates "*err": [ {"tag": "SessionId", "path": "*rep.Session-Id", "type": "*variable", diff --git a/config/config_json_test.go b/config/config_json_test.go index 8e5762db0..a4faf7dcd 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -757,7 +757,7 @@ func TestDiameterAgentJsonCfg(t *testing.T) { Synced_conn_requests: utils.BoolPointer(false), Asr_template: utils.StringPointer(""), Rar_template: utils.StringPointer(""), - Disconnect_method: utils.StringPointer(utils.MetaASR), + Forced_disconnect: utils.StringPointer(utils.META_NONE), Templates: map[string][]*FcTemplateJsonCfg{ utils.MetaErr: { { diff --git a/config/diametercfg.go b/config/diametercfg.go index ef1023468..cc08d06d7 100644 --- a/config/diametercfg.go +++ b/config/diametercfg.go @@ -34,7 +34,7 @@ type DiameterAgentCfg struct { SyncedConnReqs bool ASRTemplate string RARTemplate string - DisconnectMethod string + ForcedDisconnect string Templates map[string][]*FCTemplate RequestProcessors []*RequestProcessor } @@ -90,8 +90,8 @@ func (da *DiameterAgentCfg) loadFromJsonCfg(jsnCfg *DiameterAgentJsonCfg, separa if jsnCfg.Rar_template != nil { da.RARTemplate = *jsnCfg.Rar_template } - if jsnCfg.Disconnect_method != nil { - da.DisconnectMethod = *jsnCfg.Disconnect_method + if jsnCfg.Forced_disconnect != nil { + da.ForcedDisconnect = *jsnCfg.Forced_disconnect } if jsnCfg.Templates != nil { if da.Templates == nil { diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 1571da964..859297637 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -316,7 +316,7 @@ type DiameterAgentJsonCfg struct { Synced_conn_requests *bool Asr_template *string Rar_template *string - Disconnect_method *string + Forced_disconnect *string Templates map[string][]*FcTemplateJsonCfg Request_processors *[]*ReqProcessorJsnCfg } diff --git a/data/conf/samples/diamagent_internal/cgrates.json b/data/conf/samples/diamagent_internal/cgrates.json index e34e224c1..de15120bf 100644 --- a/data/conf/samples/diamagent_internal/cgrates.json +++ b/data/conf/samples/diamagent_internal/cgrates.json @@ -58,6 +58,7 @@ "enabled": true, "asr_template": "*asr", "rar_template": "*rar", + "forced_disconnect": "*asr", // the request to send to diameter on DisconnectSession <*none|*asr|*rar> }, "apiers": { diff --git a/data/conf/samples/diamagent_mongo/cgrates.json b/data/conf/samples/diamagent_mongo/cgrates.json index e90a28fe0..c55c32459 100644 --- a/data/conf/samples/diamagent_mongo/cgrates.json +++ b/data/conf/samples/diamagent_mongo/cgrates.json @@ -63,6 +63,7 @@ "enabled": true, "asr_template": "*asr", "rar_template": "*rar", + "forced_disconnect": "*asr", // the request to send to diameter on DisconnectSession <*none|*asr|*rar> }, "apiers": { diff --git a/data/conf/samples/diamagent_mysql/cgrates.json b/data/conf/samples/diamagent_mysql/cgrates.json index 2ac565475..4fdb9466d 100644 --- a/data/conf/samples/diamagent_mysql/cgrates.json +++ b/data/conf/samples/diamagent_mysql/cgrates.json @@ -59,6 +59,7 @@ "enabled": true, "asr_template": "*asr", "rar_template": "*rar", + "forced_disconnect": "*asr", // the request to send to diameter on DisconnectSession <*none|*asr|*rar> }, "apiers": { diff --git a/sessions/libsessions.go b/sessions/libsessions.go index ced2368c0..9ea4d7d16 100644 --- a/sessions/libsessions.go +++ b/sessions/libsessions.go @@ -44,7 +44,7 @@ type BiRPClient interface { Call(serviceMethod string, args interface{}, reply interface{}) error V1DisconnectSession(args utils.AttrDisconnectSession, reply *string) (err error) V1GetActiveSessionIDs(ignParam string, sessionIDs *[]*SessionID) (err error) - V1SendRAR(originID string, reply *string) (err error) + V1ReAuthorize(originID string, reply *string) (err error) } // getSessionTTL retrieves SessionTTL setting out of ev diff --git a/sessions/sessions.go b/sessions/sessions.go index 8cec96bd9..748048fb7 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -3618,21 +3618,21 @@ func (sS *SessionS) sendRar(s *Session) (err error) { clnt := sS.biJClnt(s.ClientConnID) if clnt == nil { return fmt.Errorf("calling %s requires bidirectional JSON connection, connID: <%s>", - utils.SessionSv1SendRAR, s.ClientConnID) + utils.SessionSv1ReAuthorize, s.ClientConnID) } var originID string if originID, err = s.EventStart.GetString(utils.OriginID); err != nil { return } var rply string - if err = clnt.conn.Call(utils.SessionSv1SendRAR, originID, &rply); err == utils.ErrNotImplemented { + if err = clnt.conn.Call(utils.SessionSv1ReAuthorize, originID, &rply); err == utils.ErrNotImplemented { err = nil } return } -// BiRPCv1SendRAR sends a RAR for sessions matching sessions -func (sS *SessionS) BiRPCv1SendRAR(clnt rpcclient.ClientConnector, +// BiRPCv1ReAuthorize sends a RAR for sessions matching sessions +func (sS *SessionS) BiRPCv1ReAuthorize(clnt rpcclient.ClientConnector, args *utils.SessionFilter, reply *string) (err error) { if args == nil { //protection in case on nil args = &utils.SessionFilter{} diff --git a/utils/consts.go b/utils/consts.go index ace166983..c6028b371 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -1356,7 +1356,7 @@ const ( SessionSv1ActivateSessions = "SessionSv1.ActivateSessions" SessionSv1DeactivateSessions = "SessionSv1.DeactivateSessions" SMGenericV1InitiateSession = "SMGenericV1.InitiateSession" - SessionSv1SendRAR = "SessionSv1.SendRAR" + SessionSv1ReAuthorize = "SessionSv1.ReAuthorize" ) // Responder APIs