mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Skel of dry run for DiameterAgent integration
This commit is contained in:
@@ -99,7 +99,9 @@ func (da *DNSAgent) handleMessage(w dns.ResponseWriter, req *dns.Msg) {
|
||||
reqVars[QueryType] = dns.TypeToString[req.Question[0].Qtype]
|
||||
rply := new(dns.Msg)
|
||||
rply.SetReply(req)
|
||||
if req.Question[0].Qtype == dns.TypeNAPTR {
|
||||
// message preprocesing
|
||||
switch req.Question[0].Qtype {
|
||||
case dns.TypeNAPTR:
|
||||
e164, err := e164FromNAPTR(req.Question[0].Name)
|
||||
if err != nil {
|
||||
utils.Logger.Warning(
|
||||
|
||||
@@ -171,6 +171,12 @@ func updateDNSMsgFromNM(msg *dns.Msg, nm *config.NavigableMap) (err error) {
|
||||
return
|
||||
}
|
||||
lastAnswer.(*dns.A).A = net.ParseIP(ip)
|
||||
case dns.TypeNAPTR:
|
||||
if rr, err := dns.NewRR(`IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:customer-service@example.com!" .`); err != nil {
|
||||
return err
|
||||
} else {
|
||||
lastAnswer = rr
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
18
data/conf/samples/dnsagent/dryrun.json
Normal file
18
data/conf/samples/dnsagent/dryrun.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
|
||||
"diameter_agent": {
|
||||
"request_processors": [
|
||||
{
|
||||
"id": "dryrun1",
|
||||
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174963"],
|
||||
"flags": ["*dryrun"],
|
||||
"request_fields":[
|
||||
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
|
||||
],
|
||||
"reply_fields":[
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user