mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update go-diameter library
This commit is contained in:
committed by
Dan Christian Bogos
parent
76f8373a9c
commit
26db18c80c
@@ -209,7 +209,7 @@ func (da *DiameterAgent) handleMessage(c diam.Conn, m *diam.Message) {
|
||||
writeOnConn(c, diamErr)
|
||||
return
|
||||
}
|
||||
a, err := diamAnswer(m, diam.Success, false,
|
||||
a, err := diamAnswer(m, 0, false,
|
||||
rply, da.cgrCfg.GeneralCfg().DefaultTimezone)
|
||||
if err != nil {
|
||||
utils.Logger.Warning(
|
||||
|
||||
@@ -407,7 +407,7 @@ func (dP *diameterDP) FieldAsInterface(fldPath []string) (data interface{}, err
|
||||
// diamAnswer builds up the answer to be sent back to the client
|
||||
func diamAnswer(m *diam.Message, resCode uint32, errFlag bool,
|
||||
rply *config.NavigableMap, tmz string) (a *diam.Message, err error) {
|
||||
a = m.Answer(resCode)
|
||||
a = newDiamAnswer(m, resCode)
|
||||
if errFlag {
|
||||
a.Header.CommandFlags = diam.ErrorFlag
|
||||
}
|
||||
@@ -489,3 +489,19 @@ func disectDiamListen(addrs string) (ipAddrs []string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// newDiamAnswer temporary until fiorix will fix the issue
|
||||
func newDiamAnswer(m *diam.Message, resCode uint32) *diam.Message {
|
||||
nm := diam.NewMessage(
|
||||
m.Header.CommandCode,
|
||||
m.Header.CommandFlags&^diam.RequestFlag, // Reset the Request bit.
|
||||
m.Header.ApplicationID,
|
||||
m.Header.HopByHopID,
|
||||
m.Header.EndToEndID,
|
||||
m.Dictionary(),
|
||||
)
|
||||
if resCode != 0 {
|
||||
nm.NewAVP(avp.ResultCode, avp.Mbit, 0, datatype.Unsigned32(resCode))
|
||||
}
|
||||
return nm
|
||||
}
|
||||
|
||||
@@ -386,6 +386,8 @@ const CGRATES_CFG_JSON = `
|
||||
"*cca": [
|
||||
{"tag": "SessionId", "field_id": "Session-Id", "type": "*composed",
|
||||
"value": "~*req.Session-Id", "mandatory": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant",
|
||||
"value": "2001"},
|
||||
{"tag": "OriginHost", "field_id": "Origin-Host", "type": "*composed",
|
||||
"value": "~*vars.OriginHost", "mandatory": true},
|
||||
{"tag": "OriginRealm", "field_id": "Origin-Realm", "type": "*composed",
|
||||
|
||||
@@ -610,6 +610,10 @@ func TestDiameterAgentJsonCfg(t *testing.T) {
|
||||
Type: utils.StringPointer(utils.META_COMPOSED),
|
||||
Value: utils.StringPointer("~*req.Session-Id"),
|
||||
Mandatory: utils.BoolPointer(true)},
|
||||
{Tag: utils.StringPointer("ResultCode"),
|
||||
Field_id: utils.StringPointer("Result-Code"),
|
||||
Type: utils.StringPointer(utils.META_CONSTANT),
|
||||
Value: utils.StringPointer("2001")},
|
||||
{Tag: utils.StringPointer("OriginHost"),
|
||||
Field_id: utils.StringPointer("Origin-Host"),
|
||||
Type: utils.StringPointer(utils.META_COMPOSED),
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
|
||||
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
|
||||
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
|
||||
],
|
||||
@@ -61,6 +62,7 @@
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
|
||||
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
|
||||
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
|
||||
],
|
||||
@@ -89,6 +91,11 @@
|
||||
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
|
||||
],
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
|
||||
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
|
||||
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
|
||||
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
|
||||
],
|
||||
@@ -61,6 +62,7 @@
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
|
||||
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
|
||||
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
|
||||
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
|
||||
],
|
||||
@@ -89,6 +91,11 @@
|
||||
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
|
||||
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
|
||||
],
|
||||
"reply_fields":[
|
||||
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
|
||||
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
|
||||
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
2
glide.lock
generated
2
glide.lock
generated
@@ -22,7 +22,7 @@ imports:
|
||||
- name: github.com/cgrates/rpcclient
|
||||
version: 7316bff37a2b8692fbadd57f9c9cda070cc33081
|
||||
- name: github.com/fiorix/go-diameter
|
||||
version: 16028e641c19a8dd67509053bc558d389258ff6d
|
||||
version: abaf0a5b14a05f3a4a75b8fe23066ab1f898aeac
|
||||
subpackages:
|
||||
- diam
|
||||
- diam/avp
|
||||
|
||||
Reference in New Issue
Block a user