Add SRV and A record implementation & tests

This commit is contained in:
arberkatellari
2023-06-30 11:02:24 -04:00
committed by Dan Christian Bogos
parent af727ce24d
commit bd68a65705
18 changed files with 1743 additions and 152 deletions

View File

@@ -21,9 +21,52 @@
{"tag": "NAPTRService", "path": "*rep.Answer.Service",
"type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegex", "path": "*rep.Answer.Regexp",
"type": "*variable", "value": "~*cgrep.Attributes.NAPTRAddress"},
],
"type": "*variable", "value": "~*cgrep.Attributes.NAPTRAddress"}
]
},
],
},
{
"id": "AAttributes",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:dns.google."],
"flags": ["*authorize","*attributes","*log"],
"request_fields":[
{"tag": "Domain", "path": "*cgreq.Domain",
"type": "*constant", "value": "dns.google."},
{"tag": "ADomain0", "path": "*cgreq.Aip0",
"type": "*constant", "value": "*attributes"},
{"tag": "ADomain1", "path": "*cgreq.Aip1",
"type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "dns.google."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip0", "path": "*rep.Answer.A", "type": "*variable", "value": "~*cgrep.Attributes.Aip0"},
{"tag": "Aname1", "path": "*rep.Answer[1].Hdr.Name", "type": "*constant", "value": "dns.google."},
{"tag": "Attl1", "path": "*rep.Answer[1].Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass1", "path": "*rep.Answer[1].Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype1", "path": "*rep.Answer[1].Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip1", "path": "*rep.Answer[1].A", "type": "*variable", "value": "~*cgrep.Attributes.Aip1"}
]
},
{
"id": "SRVAttributes",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_ldap._tcp.google.com."],
"flags": ["*authorize", "*attributes","*log"],
"request_fields":[
{"tag": "SRVAddress", "path": "*cgreq.SRVAddress",
"type": "*constant", "value": "_ldap._tcp.google.com."},
{"tag": "SRVName", "path": "*cgreq.SRVName",
"type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_ldap._tcp.google.com."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "5"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "0"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "389"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*variable", "value": "~*cgrep.Attributes.SRVName"}
]
}
]
}
}

View File

@@ -8,22 +8,22 @@
"general": {
"log_level": 7, // control the level of messages logged (0-emerg to 7-debug)
"log_level": 7 // control the level of messages logged (0-emerg to 7-debug)
},
"data_db": {
"db_type": "*internal",
"db_type": "*internal"
},
"stor_db": {
"db_type": "*internal",
"db_type": "*internal"
},
"schedulers": {
"enabled": true,
"cdrs_conns": ["*internal"],
"cdrs_conns": ["*internal"]
},
@@ -33,41 +33,41 @@
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"],
"routes_conns": ["*localhost"],
"routes_conns": ["*localhost"]
},
"rals": {
"enabled": true,
"enabled": true
},
"cdrs": {
"enabled": true,
"rals_conns": ["*internal"],
"rals_conns": ["*internal"]
},
"chargers": {
"enabled": true,
"enabled": true
},
"attributes": {
"enabled": true,
"enabled": true
},
"routes": {
"enabled": true,
"enabled": true
},
"tls": {
"server_certificate" : "/usr/share/cgrates/tls/server.crt", // path to server certificate(must conatin server.crt + ca.crt)
"server_key":"/usr/share/cgrates/tls/server.key", // path to server key
"client_certificate" : "/usr/share/cgrates/tls/client.crt", // path to client certificate(must conatin client.crt + ca.crt)
"client_key":"/usr/share/cgrates/tls/client.key", // path to client key
"ca_certificate":"/usr/share/cgrates/tls/ca.crt",
"server_certificate" : "/usr/share/cgrates/tls/server.crt",
"server_key":"/usr/share/cgrates/tls/server.key",
"client_certificate" : "/usr/share/cgrates/tls/client.crt",
"client_key":"/usr/share/cgrates/tls/client.key",
"ca_certificate":"/usr/share/cgrates/tls/ca.crt"
},
"dns_agent": {
@@ -84,15 +84,14 @@
{
"address":":2054",
"network":"tcp-tls"
},
}
],
"sessions_conns": ["*localhost"],
"sessions_conns": ["*localhost"]
},
"apiers": {
"enabled": true,
"scheduler_conns": ["*internal"],
},
}
"scheduler_conns": ["*internal"]
}
}

View File

@@ -1,22 +1,52 @@
{
"dns_agent": {
"request_processors": [
{
"id": "DryRunNAPTR",
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:4986517174963"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
{"tag": "NAPTRPreference", "path": "*rep.Answer.Preference", "type": "*constant", "value": "10"},
{"tag": "NAPTRFlags", "path": "*rep.Answer.Flags", "type": "*constant", "value": "U"},
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
],
},
],
},
"dns_agent": {
"request_processors": [
{
"id": "DryRunNAPTR",
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:4986517174963"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
{"tag": "NAPTRPreference", "path": "*rep.Answer.Preference", "type": "*constant", "value": "10"},
{"tag": "NAPTRFlags", "path": "*rep.Answer.Flags", "type": "*constant", "value": "U"},
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."}
]
},
{
"id": "DryRunA",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:cgrates.org."],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "cgrates.org."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "51.38.77.188"}
]
},
{
"id": "DryRunSRV",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_sip._tcp.opensips.org."],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_sip._tcp.opensips.org."},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "5060"},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "0"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "50"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "opensips.org."}
]
}
]
}
}

View File

@@ -6,7 +6,7 @@
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:5986517174965", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -17,8 +17,8 @@
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"},
],
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "OptsWithAttributes",
@@ -27,7 +27,7 @@
"request_fields":[
{"tag": "Origin", "path": "*cgreq.Origin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domanin", "path": "*cgreq.Domanin", "type": "*variable", "value": "~*vars.QueryName{*e164Domain}"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -36,10 +36,82 @@
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true},
],
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
},
],
},
{
"id": "OptsA",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:example.com.", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "example.com."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "93.184.216.34"},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "AOptsWithAttributes",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:opendns.com."],
"flags": ["*event","*attributes"],
"request_fields":[
{"tag": "Origin", "path": "*cgreq.AOrigin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domain", "path": "*cgreq.ASIPDomain", "type": "*variable", "value": "~*vars.QueryName"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "example.com."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "146.112.62.105"},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
},
{
"id": "OptsSRV",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_matrix._tcp.matrix.org.", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_xmpp-client._tcp.xmpp.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "10"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "5"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "8443"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "matrix-federation.matrix.org.cdn.cloudflare.net."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "SRVOptsWithAttributes",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_sip._udp.opensips.org."],
"flags": ["*event","*attributes"],
"request_fields":[
{"tag": "Origin", "path": "*cgreq.SRVOrigin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domain", "path": "*cgreq.SRVDomain", "type": "*variable", "value": "~*vars.QueryName"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_sip._udp.opensips.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "0"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "50"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "5060"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "opensips.org."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
}
]
}
}
}

View File

@@ -8,12 +8,12 @@
"*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
{"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
],
"blocker": true} // enforces continue_on_success so we can check answer with filters
]
},
{
"id": "NAPTRSuppliersOneSupplier",
@@ -34,8 +34,8 @@
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*group",
"value": "~*cgrep.RouteProfiles[0].Routes[0].RouteParameters"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement",
"type": "*group", "value": "."},
],
"type": "*group", "value": "."}
]
},
{
"id": "NAPTRSuppliersTwoSuppliers",
@@ -56,10 +56,96 @@
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*group",
"value": "~*cgrep.RouteProfiles[0].Routes[1].RouteParameters"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement",
"type": "*group", "value": "."},
],
"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"}
]
}
]
}
}

View File

@@ -22,10 +22,52 @@
{"tag": "NAPTRService", "path": "*rep.Answer.Service",
"type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegex", "path": "*rep.Answer.Regexp",
"type": "*variable", "value": "~*cgrep.Attributes.NAPTRAddress"},
],
"type": "*variable", "value": "~*cgrep.Attributes.NAPTRAddress"}
]
},
],
},
{
"id": "AAttributes",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:dns.google."],
"flags": ["*authorize","*attributes","*log"],
"request_fields":[
{"tag": "Domain", "path": "*cgreq.Domain",
"type": "*constant", "value": "dns.google."},
{"tag": "ADomain0", "path": "*cgreq.Aip0",
"type": "*constant", "value": "*attributes"},
{"tag": "ADomain1", "path": "*cgreq.Aip1",
"type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "dns.google."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip0", "path": "*rep.Answer.A", "type": "*variable", "value": "~*cgrep.Attributes.Aip0"},
{"tag": "Aname1", "path": "*rep.Answer[1].Hdr.Name", "type": "*constant", "value": "dns.google."},
{"tag": "Attl1", "path": "*rep.Answer[1].Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass1", "path": "*rep.Answer[1].Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype1", "path": "*rep.Answer[1].Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip1", "path": "*rep.Answer[1].A", "type": "*variable", "value": "~*cgrep.Attributes.Aip1"}
]
},
{
"id": "SRVAttributes",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_ldap._tcp.google.com."],
"flags": ["*authorize", "*attributes","*log"],
"request_fields":[
{"tag": "SRVAddress", "path": "*cgreq.SRVAddress",
"type": "*constant", "value": "_ldap._tcp.google.com."},
{"tag": "SRVName", "path": "*cgreq.SRVName",
"type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_ldap._tcp.google.com."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "5"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "0"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "389"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*variable", "value": "~*cgrep.Attributes.SRVName"}
]
}
]
}
}

View File

@@ -7,7 +7,7 @@
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:4986517174963"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -15,10 +15,39 @@
{"tag": "NAPTRFlags", "path": "*rep.Answer.Flags", "type": "*constant", "value": "U"},
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
],
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."}
]
},
],
},
}
{
"id": "DryRunA",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:cgrates.org."],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "cgrates.org."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "51.38.77.188"}
]
},
{
"id": "DryRunSRV",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_sip._tcp.opensips.org."],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_sip._tcp.opensips.org."},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "5060"},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "0"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "50"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "opensips.org."}
]
}
]
}
}

View File

@@ -6,7 +6,7 @@
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:5986517174965", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -17,8 +17,8 @@
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"},
],
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "OptsWithAttributes",
@@ -27,7 +27,7 @@
"request_fields":[
{"tag": "Origin", "path": "*cgreq.Origin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domanin", "path": "*cgreq.Domanin", "type": "*variable", "value": "~*vars.QueryName{*e164Domain}"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -36,10 +36,81 @@
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true},
],
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
},
],
},
}
{
"id": "OptsA",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:example.com.", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "example.com."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "93.184.216.34"},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "AOptsWithAttributes",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:opendns.com."],
"flags": ["*event","*attributes"],
"request_fields":[
{"tag": "Origin", "path": "*cgreq.AOrigin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domain", "path": "*cgreq.ASIPDomain", "type": "*variable", "value": "~*vars.QueryName"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "example.com."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "146.112.62.105"},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
},
{
"id": "OptsSRV",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_matrix._tcp.matrix.org.", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_xmpp-client._tcp.xmpp.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "10"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "5"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "8443"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "matrix-federation.matrix.org.cdn.cloudflare.net."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "SRVOptsWithAttributes",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_sip._udp.opensips.org."],
"flags": ["*event","*attributes"],
"request_fields":[
{"tag": "Origin", "path": "*cgreq.SRVOrigin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domain", "path": "*cgreq.SRVDomain", "type": "*variable", "value": "~*vars.QueryName"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_sip._udp.opensips.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "0"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "50"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "5060"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "opensips.org."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
}
]
}
}

View File

@@ -59,6 +59,92 @@
"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"}
]
}
],
},

View File

@@ -21,9 +21,52 @@
{"tag": "NAPTRService", "path": "*rep.Answer.Service",
"type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegex", "path": "*rep.Answer.Regexp",
"type": "*variable", "value": "~*cgrep.Attributes.NAPTRAddress"},
],
"type": "*variable", "value": "~*cgrep.Attributes.NAPTRAddress"}
]
},
],
},
{
"id": "AAttributes",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:dns.google."],
"flags": ["*authorize","*attributes","*log"],
"request_fields":[
{"tag": "Domain", "path": "*cgreq.Domain",
"type": "*constant", "value": "dns.google."},
{"tag": "ADomain0", "path": "*cgreq.Aip0",
"type": "*constant", "value": "*attributes"},
{"tag": "ADomain1", "path": "*cgreq.Aip1",
"type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "dns.google."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip0", "path": "*rep.Answer.A", "type": "*variable", "value": "~*cgrep.Attributes.Aip0"},
{"tag": "Aname1", "path": "*rep.Answer[1].Hdr.Name", "type": "*constant", "value": "dns.google."},
{"tag": "Attl1", "path": "*rep.Answer[1].Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass1", "path": "*rep.Answer[1].Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype1", "path": "*rep.Answer[1].Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip1", "path": "*rep.Answer[1].A", "type": "*variable", "value": "~*cgrep.Attributes.Aip1"}
]
},
{
"id": "SRVAttributes",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_ldap._tcp.google.com."],
"flags": ["*authorize", "*attributes","*log"],
"request_fields":[
{"tag": "SRVAddress", "path": "*cgreq.SRVAddress",
"type": "*constant", "value": "_ldap._tcp.google.com."},
{"tag": "SRVName", "path": "*cgreq.SRVName",
"type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_ldap._tcp.google.com."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "5"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "0"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "389"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*variable", "value": "~*cgrep.Attributes.SRVName"}
]
}
]
}
}

View File

@@ -6,7 +6,7 @@
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:4986517174963"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -14,9 +14,39 @@
{"tag": "NAPTRFlags", "path": "*rep.Answer.Flags", "type": "*constant", "value": "U"},
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
],
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."}
]
},
],
},
{
"id": "DryRunA",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:cgrates.org."],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "cgrates.org."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "51.38.77.188"}
]
},
{
"id": "DryRunSRV",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_sip._tcp.opensips.org."],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_sip._tcp.opensips.org."},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "5060"},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "0"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "50"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "opensips.org."}
]
}
]
}
}

View File

@@ -6,7 +6,7 @@
"filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.QueryName{*e164}:5986517174965", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -17,8 +17,8 @@
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"},
],
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "OptsWithAttributes",
@@ -27,7 +27,7 @@
"request_fields":[
{"tag": "Origin", "path": "*cgreq.Origin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domanin", "path": "*cgreq.Domanin", "type": "*variable", "value": "~*vars.QueryName{*e164Domain}"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "NAPTROrder", "path": "*rep.Answer.Order", "type": "*constant", "value": "100"},
@@ -36,10 +36,82 @@
{"tag": "NAPTRService", "path": "*rep.Answer.Service", "type": "*constant", "value": "E2U+SIP"},
{"tag": "NAPTRRegexp", "path": "*rep.Answer.Regexp", "type": "*constant", "value": "!^(.*)$!sip:\\1@172.16.1.10.!"},
{"tag": "NAPTRReplacement", "path": "*rep.Answer.Replacement", "type": "*constant", "value": "."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true},
],
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
},
],
},
{
"id": "OptsA",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:example.com.", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "example.com."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "93.184.216.34"},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "AOptsWithAttributes",
"filters": ["*string:~*vars.QueryType:A", "*string:~*vars.QueryName:opendns.com."],
"flags": ["*event","*attributes"],
"request_fields":[
{"tag": "Origin", "path": "*cgreq.AOrigin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domain", "path": "*cgreq.ASIPDomain", "type": "*variable", "value": "~*vars.QueryName"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "Aname", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "example.com."},
{"tag": "Attl", "path": "*rep.Answer.Hdr.Ttl", "type": "*constant", "value": "300"},
{"tag": "Aclass", "path": "*rep.Answer.Hdr.Class", "type": "*constant", "value": "1"},
{"tag": "Arrtype", "path": "*rep.Answer.Hdr.Rrtype", "type": "*constant", "value": "1"},
{"tag": "Aip", "path": "*rep.Answer.A", "type": "*constant", "value": "146.112.62.105"},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
},
{
"id": "OptsSRV",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_matrix._tcp.matrix.org.", "*string:~*req.Option[0].Uri:sip:cgrates@cgrates.org"],
"flags": ["*dryrun","*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_xmpp-client._tcp.xmpp.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "10"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "5"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "8443"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "matrix-federation.matrix.org.cdn.cloudflare.net."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*constant", "value": "sip:cgrates@cgrates.co"},
{"tag": "Opts2", "path": "*rep.Option.Uri", "type": "*group", "value": "sip:cgrates@cgrates.net", "new_branch":true},
{"tag": "Opts3", "path": "*rep.Option[0].Uri", "type": "*constant", "value": "sip:cgrates@cgrates.com"}
]
},
{
"id": "SRVOptsWithAttributes",
"filters": ["*string:~*vars.QueryType:SRV", "*string:~*vars.QueryName:_sip._udp.opensips.org."],
"flags": ["*event","*attributes"],
"request_fields":[
{"tag": "Origin", "path": "*cgreq.SRVOrigin", "type": "*variable", "value": "~*req.Option[0].Uri{*sipuri_user}"},
{"tag": "Domain", "path": "*cgreq.SRVDomain", "type": "*variable", "value": "~*vars.QueryName"},
{"tag": "NewSipURI", "path": "*cgreq.SipURI", "type": "*constant", "value": "*attributes"}
],
"reply_fields":[
{"tag": "SRVHdr", "path": "*rep.Answer.Hdr.Name", "type": "*constant", "value": "_sip._udp.opensips.org."},
{"tag": "SRVPriority", "path": "*rep.Answer.Priority", "type": "*constant", "value": "0"},
{"tag": "SRVWeight", "path": "*rep.Answer.Weight", "type": "*constant", "value": "50"},
{"tag": "SRVPort", "path": "*rep.Answer.Port", "type": "*constant", "value": "5060"},
{"tag": "SRVTarget", "path": "*rep.Answer.Target", "type": "*constant", "value": "opensips.org."},
{"tag": "Opts", "path": "*rep.Option.Uri", "type": "*variable", "value": "~*cgrep.Attributes[*raw].SipURI", "mandatory": true}
]
}
]
}
}

View File

@@ -58,6 +58,92 @@
"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"}
]
}
],
},

View File

@@ -1,4 +1,8 @@
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,Path,Type,Value,Blocker,Weight
cgrates.org,ATTR_NAPTR_ADDR,*any,*string:~*req.E164Address:4986517174964,,,*req.NAPTRAddress,*constant,sip:\1@172.16.1.1.,false,20
cgrates.org,ATTR_NAPTR_SIP_URI,*any,*string:~*req.Origin:cgrates,,,*req.SipURI,*variable,sip:cgrates@;~*req.Domanin,false,20
cgrates.org,ATTR_A_DOM,*any,*string:~*req.Domain:dns.google.,,,*req.Aip0,*constant,8.8.8.8,false,20
cgrates.org,ATTR_A_DOM,*any,*string:~*req.Domain:dns.google.,,,*req.Aip1,*constant,8.8.4.4,false,20
cgrates.org,ATTR_A_SIP_URI,*any,*string:~*req.AOrigin:cgrates,,,*req.SipURI,*variable,sip:cgrates@;~*req.ASIPDomain,false,20
cgrates.org,ATTR_SRV,*any,*string:~*req.SRVAddress:_ldap._tcp.google.com.,,,*req.SRVName,*constant,ldap.google.com.,false,20
cgrates.org,ATTR_SRV_SIP_URI,*any,*string:~*req.SRVOrigin:cgrates,,,*req.SipURI,*variable,sip:cgrates@;~*req.SRVDomain,false,20
1 #Tenant ID Contexts FilterIDs ActivationInterval AttributeFilterIDs Path Type Value Blocker Weight
2 cgrates.org ATTR_NAPTR_ADDR *any *string:~*req.E164Address:4986517174964 *req.NAPTRAddress *constant sip:\1@172.16.1.1. false 20
3 cgrates.org ATTR_NAPTR_SIP_URI *any *string:~*req.Origin:cgrates *req.SipURI *variable sip:cgrates@;~*req.Domanin false 20
4 cgrates.org ATTR_A_DOM *any *string:~*req.Domain:dns.google. *req.Aip0 *constant 8.8.8.8 false 20
5 cgrates.org ATTR_A_DOM *any *string:~*req.Domain:dns.google. *req.Aip1 *constant 8.8.4.4 false 20
6 cgrates.org ATTR_A_SIP_URI *any *string:~*req.AOrigin:cgrates *req.SipURI *variable sip:cgrates@;~*req.ASIPDomain false 20
7 cgrates.org ATTR_SRV *any *string:~*req.SRVAddress:_ldap._tcp.google.com. *req.SRVName *constant ldap.google.com. false 20
8 cgrates.org ATTR_SRV_SIP_URI *any *string:~*req.SRVOrigin:cgrates *req.SipURI *variable sip:cgrates@;~*req.SRVDomain false 20

View File

@@ -2,4 +2,9 @@
cgrates.org,ROUTE_ACNT_1001,*string:~*req.Account:1001,,*weight,,,,,,,,,,,10
cgrates.org,ROUTE_ACNT_1001,,,,,route1,,,,,,10,,!^(.*)$!sip:\1@172.16.1.11!,
cgrates.org,ROUTE_ACNT_1001,,,,,route2,,,,,,5,,!^(.*)$!sip:\1@172.16.1.12!,
cgrates.org,ROUTE_ACNT_1002,*string:~*req.Account:1002,,*weight,,,,,,,,,,,10
cgrates.org,ROUTE_ACNT_1002,,,,,aroute1,,,,,,10,,216.239.32.21,
cgrates.org,ROUTE_ACNT_1002,,,,,aroute2,,,,,,5,,216.239.34.21,
cgrates.org,ROUTE_ACNT_1003,*string:~*req.Account:1003,,*weight,,,,,,,,,,,10
cgrates.org,ROUTE_ACNT_1003,,,,,srvroute1,,,,,,10,,xmpp.xmpp.org.,
cgrates.org,ROUTE_ACNT_1003,,,,,srvroute2,,,,,,5,,xmpp.xmpp.com.,
1 #Tenant ID FilterIDs ActivationInterval Sorting SortingParameters RouteID RouteFilterIDs RouteAccountIDs RouteRatingPlanIDs RouteResourceIDs RouteStatIDs RouteWeight RouteBlocker RouteParameters Weight
2 cgrates.org ROUTE_ACNT_1001 *string:~*req.Account:1001 *weight 10
3 cgrates.org ROUTE_ACNT_1001 route1 10 !^(.*)$!sip:\1@172.16.1.11!
4 cgrates.org ROUTE_ACNT_1001 route2 5 !^(.*)$!sip:\1@172.16.1.12!
5 cgrates.org ROUTE_ACNT_1002 *string:~*req.Account:1002 *weight 10
6 cgrates.org ROUTE_ACNT_1002 aroute1 10 216.239.32.21
7 cgrates.org ROUTE_ACNT_1002 aroute2 5 216.239.34.21
8 cgrates.org ROUTE_ACNT_1003 *string:~*req.Account:1003 *weight 10
9 cgrates.org ROUTE_ACNT_1003 srvroute1 10 xmpp.xmpp.org.
10 cgrates.org ROUTE_ACNT_1003 srvroute2 5 xmpp.xmpp.com.