mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 16:48:45 +05:00
Renamed SendRar to ReAuthorize
This commit is contained in:
committed by
Dan Christian Bogos
parent
6123d9ead9
commit
9073127280
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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: {
|
||||
{
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -1356,7 +1356,7 @@ const (
|
||||
SessionSv1ActivateSessions = "SessionSv1.ActivateSessions"
|
||||
SessionSv1DeactivateSessions = "SessionSv1.DeactivateSessions"
|
||||
SMGenericV1InitiateSession = "SMGenericV1.InitiateSession"
|
||||
SessionSv1SendRAR = "SessionSv1.SendRAR"
|
||||
SessionSv1ReAuthorize = "SessionSv1.ReAuthorize"
|
||||
)
|
||||
|
||||
// Responder APIs
|
||||
|
||||
Reference in New Issue
Block a user