Files
cgrates/data/conf/samples/dnsagent_postgres/suppliers.json
2025-07-02 21:45:29 +02:00

151 lines
6.5 KiB
JSON

{
"dns_agent": {
"request_processors": [
{
"id": "NAPTRRoutesQuery",
"filters": ["*string:~*vars.QueryType:NAPTR",
"*string:~*vars.QueryName{*e164}:4986517174965"],
"flags": ["*message", "*routes","*continue"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.Account", "type": "*constant", "value": "1001"}, // so we can match the supplier profile
],
"reply_fields":[
{"tag": "DispatchReply", "type": "*none",
"blocker": true}, // enforces continue_on_success so we can check answer with filters
],
},
{
"id": "NAPTRSuppliersOneSupplier",
"filters": ["*string:~*vars.QueryType:NAPTR",
"*string:~*vars.QueryName{*e164}:4986517174965",
"*gte:~*cgrep.RouteProfiles.Length:1",
"*gte:~*cgrep.RouteProfiles[0].Routes.Length:1"],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order",
"type": "*group", "value": "100"},
{"tag": "NAPTRPreference", "path": "*rep.Answer.Preference",
"type": "*group", "value": "10"},
{"tag": "NAPTRFlags", "path": "*rep.Answer.Flags",
"type": "*group", "value": "U"},
{"tag": "NAPTRService", "path": "*rep.Answer.Service",
"type": "*group", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*group",
"value": "~*cgrep.RouteProfiles[0].Routes[0].RouteParameters"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement",
"type": "*group", "value": "."},
],
},
{
"id": "NAPTRSuppliersTwoSuppliers",
"filters": ["*string:~*vars.QueryType:NAPTR",
"*string:~*vars.QueryName{*e164}:4986517174965",
"*gte:~*cgrep.RouteProfiles.Length:1",
"*gte:~*cgrep.RouteProfiles[0].Routes.Length:2"],
"flags": ["*none","*continue"],
"reply_fields":[
{"tag": "NAPTROrder", "type": "*group", "new_branch": true,
"path": "*rep.Answer.Order", "value": "100"},
{"tag": "NAPTRPreference", "path": "*rep.Answer.Preference",
"type": "*group", "value": "10"},
{"tag": "NAPTRFlags", "path": "*rep.Answer.Flags",
"type": "*group", "value": "U"},
{"tag": "NAPTRService", "path": "*rep.Answer.Service",
"type": "*group", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*group",
"value": "~*cgrep.RouteProfiles[0].Routes[1].RouteParameters"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement",
"type": "*group", "value": "."},
],
},
{
"id": "ARoutesQuery",
"filters": ["*string:~*vars.QueryType:A",
"*string:~*vars.QueryName:go.dev."],
"flags": ["*message", "*routes","*continue"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.Account", "type": "*constant", "value": "1002"}
],
"reply_fields":[
{"tag": "DispatchReply", "type": "*none",
"blocker": true}
]
},
{
"id": "ASuppliersOneSupplier",
"filters": ["*string:~*vars.QueryType:A",
"*string:~*vars.QueryName:go.dev.",
"*gte:~*cgrep.RouteProfiles.Length:1",
"*gte:~*cgrep.RouteProfiles[0].Routes.Length:2"],
"flags": ["*none","*continue"],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*group", "value": "go.dev."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*group", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*group", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*group", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*group", "value": "~*cgrep.RouteProfiles[0].Routes[0].RouteParameters"}
]
},
{
"id": "ASuppliersTwoSuppliers",
"filters": ["*string:~*vars.QueryType:A",
"*string:~*vars.QueryName:go.dev.",
"*gte:~*cgrep.RouteProfiles.Length:1",
"*gte:~*cgrep.RouteProfiles[0].Routes.Length:2"],
"flags": ["*none","*continue"],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer[1].Hdr.Name", "type": "*group", "value": "go.dev."},
{"tag": "Attl", "path": "*rep.Answer[1].Hdr.Ttl", "type": "*group", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer[1].Hdr.Class", "type": "*group", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer[1].Hdr.Rrtype", "type": "*group", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer[1].A", "type": "*group", "value": "~*cgrep.RouteProfiles[0].Routes[1].RouteParameters"}
]
},
{
"id": "SRVRoutesQuery",
"filters": ["*string:~*vars.QueryType:SRV",
"*string:~*vars.QueryName:_xmpp-client._tcp.xmpp.org."],
"flags": ["*message", "*routes","*continue"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.Account", "type": "*constant", "value": "1003"}
],
"reply_fields":[
{"tag": "DispatchReply", "type": "*none",
"blocker": true}
]
},
{
"id": "SRVSuppliersOneSupplier",
"filters": ["*string:~*vars.QueryType:SRV",
"*string:~*vars.QueryName:_xmpp-client._tcp.xmpp.org.",
"*gte:~*cgrep.RouteProfiles.Length:1",
"*gte:~*cgrep.RouteProfiles[0].Routes.Length:1"],
"flags": ["*none","*continue"],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*group", "value": "_xmpp-client._tcp.xmpp.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*group", "value": "1"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*group", "value": "1"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*group", "value": "9222"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*group", "value": "~*cgrep.RouteProfiles[0].Routes[0].RouteParameters"}
]
},
{
"id": "SRVSuppliersTwoSuppliers",
"filters": ["*string:~*vars.QueryType:SRV",
"*string:~*vars.QueryName:_xmpp-client._tcp.xmpp.org.",
"*gte:~*cgrep.RouteProfiles.Length:1",
"*gte:~*cgrep.RouteProfiles[0].Routes.Length:2"],
"flags": ["*none","*continue"],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer[1].Hdr.Name", "type": "*group", "value": "_xmpp-client._tcp.xmpp.org."},
{"tag": "SRVPriority", "path": "*rep.Answer[1].Priority", "type": "*group", "value": "1"},
{"tag": "SRVWeight", "path": "*rep.Answer[1].Weight", "type": "*group", "value": "1"},
{"tag": "SRVPort", "path": "*rep.Answer[1].Port", "type": "*group", "value": "9222"},
{"tag": "SRVTarget", "path": "*rep.Answer[1].Target", "type": "*group", "value": "~*cgrep.RouteProfiles[0].Routes[1].RouteParameters"}
]
}
],
},
}