Forum Discussion
Gy Diameter irule example
- Oct 12, 2022
try something like below.
replace parent with subscription-id
replace avp1 with subscription-id-type, avp1 value would be either 0 or 1 (set to match what you are looking for)
replace avp2 with subscription-id-data
vendor-id is optional, you can remove them or set to 0
# <parentAvpName>
set count [DIAMETER::avp count <parentAvpCode> vendor-id <parentAvpVendorId>]
set index 0
set myavp ""
while { $index < $count } {
set parent [DIAMETER::avp data get <parentAvpCode> grouped vendor-id <parentAvpVendorId> index $index]
# <avp1Name>
set child [DIAMETER::avp data get <avp1Code> <avp1Format> vendor-id <avp1VendorId> source $parent]
if { $child == "<avp1ValueId>" } {
# <avp0Name>
set myavp [DIAMETER::avp data get <avp0Code> <avp0Format> vendor-id <avp0VendorId> source $parent]
break
}
incr index
}note that you can generate this from diameter wizard (or diameter iAppsLX)
I have never dealt with this, looks like you have to use DIAMETER::avp command to get the group data, then the info within that list that is returned? Maybe something like this (but be warned, I don't know DIAMETER at all)
when DIAMETER_EGRESS {
if {[DIAMETER::command] == 272} {
set charging_char [DIAMETER::avp data get 874 "3GPP-Charging-Characteristics"]
set charging_id [DIAMETER::avp data get 874 "3GPP-Charging-Id"]
set imsi [DIAMETER::avp data get 874 "3GPP-IMSI"]
}
log local0. "Details: $charging_char, $charging_id, $imsi"
}
if that bears no fruit, you can try the 873 code first with the "PS-Information" in place of what's there, or just log the entire message with the DIAMETER::message command and start to pick that apart to figure out the right combination of parent/child AVP codes. This is what I think is relevant.
- Service-Information (873)
- PS-Information (874)
- 3GPP-Charging-Characteristics (13)
- 3GPP-Charging-Id (2)
- 3GPP-IMSI (1)
Hopefully this at least gets you started.
- Taut_SRISOMCHAIOct 12, 2022Employee
Hi JRahm,
Thanks for your kindly feedback.
Finally i can get those data from PS-info avp by getting the child avp from the grouped first then refer its as the new stream by source command. Thanks alot for your hint!..
i have another question for the Subsriber-ID (443) where this avp grouped is presented 2 times for the DATA-TYPE = IMSI(1) and E164(0) when i read the grouped is same 443 i always get only E164 but i expected the data with the IMSI type (1) then i want the avp 444 string in this grouped. If anyone can hint or suggest will be very very appreciated.
Best regards,
Taut S
when DIAMETER_INGRESS {
if { [DIAMETER::command] == 272 } {
log local0. "Codes all I: [DIAMETER::avp codes]"
set psinfo [DIAMETER::avp data get 873 grouped]
set ps874 [DIAMETER::avp data get 874 grouped source $psinfo ]
set charging_char [DIAMETER::avp data get 13 string source $ps874 ]
set 3gppimsi [DIAMETER::avp data get 1 string source $ps874 ]
log local0. "Session ID: [DIAMETER::session]"
log local0. "Found PSinfo codes count([DIAMETER::avp count source $app_spec_avp]) AVPs within PS-Info AVP"
log local0. "Codes under PSinfo 873: [DIAMETER::avp codes source $app_spec_avp ]"
log local0. "User: [DIAMETER::avp data get 1 string]"
log local0. "CC: $charging_char , IMSI: $3gppimsi"
}
}- Nat_ThirasuttakornOct 12, 2022Employee
try something like below.
replace parent with subscription-id
replace avp1 with subscription-id-type, avp1 value would be either 0 or 1 (set to match what you are looking for)
replace avp2 with subscription-id-data
vendor-id is optional, you can remove them or set to 0
# <parentAvpName>
set count [DIAMETER::avp count <parentAvpCode> vendor-id <parentAvpVendorId>]
set index 0
set myavp ""
while { $index < $count } {
set parent [DIAMETER::avp data get <parentAvpCode> grouped vendor-id <parentAvpVendorId> index $index]
# <avp1Name>
set child [DIAMETER::avp data get <avp1Code> <avp1Format> vendor-id <avp1VendorId> source $parent]
if { $child == "<avp1ValueId>" } {
# <avp0Name>
set myavp [DIAMETER::avp data get <avp0Code> <avp0Format> vendor-id <avp0VendorId> source $parent]
break
}
incr index
}note that you can generate this from diameter wizard (or diameter iAppsLX)
- Taut_SRISOMCHAINov 02, 2022Employee
Thanks P'Nat, it works! The index is exactly the solution.
Here is my code from your suggestion.
###P'NAT HINT####
set count [DIAMETER::avp count 443 ]
set index 0
set myavp ""
while { $index < $count } {
set parent [DIAMETER::avp data get 443 grouped index $index]
# <avp1Name>
log local0. "Inx: $index"
log local0. "Codes Parent: [DIAMETER::avp codes source $parent ]"
set child [DIAMETER::avp data get 450 integer32 source $parent]
if { $child == "1" } {
# <avp0Name>
set myavp [DIAMETER::avp data get 444 string source $parent]
log local0. "imsi: $myavp"
break
}
incr index
}Then i got what i want already, Thanks alot for your kindly help krab.
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Inx: 0
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Codes Parent: 1400 450
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Inx: 1
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Codes Parent: 450 444
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: imsi: 4162796100
- JRahmOct 12, 2022Admin
glad the nudge was helpful. I think we need better documentation on the DIAMETER::avp page and maybe an article or two to help clarify how to use it. I'll ask around.
I probably won't be helpful with your follow-up inquiry, but hopefully we'll get some general answers. I'll let you know.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com