Forum Discussion
Gy Diameter irule example
Dear experts,
I am studying the Gy diameter MRF to make a routing based on the IMSI and 3GPP-Charging-Characteristics but those are under the AVP grouped. Can anyone please suggest how can i extract those data as the string or octet?
Diameter Protocol
Version: 0x01
Length: 772
Flags: 0xc0, Request, Proxyable
Command Code: 272 Credit-Control
ApplicationId: Diameter Credit Control Application (4)
Hop-by-Hop Identifier: 0x14d943d3
End-to-End Identifier: 0x8c7835cc
[Answer In: 10]
AVP: Subscription-Id(443) l=32 f=-M-
AVP: Session-Id(263) l=18 f=-M- val=pgw;010100
AVP: Subscription-Id(443) l=40 f=-M-
AVP Code: 443 Subscription-Id
AVP Flags: 0x40, Mandatory: Set
AVP Length: 40
Subscription-Id: 000001c24000000c00000001000001bc40000012343136323739363130300000
AVP: Subscription-Id-Type(450) l=12 f=-M- val=END_USER_IMSI (1)
AVP Code: 450 Subscription-Id-Type
AVP Flags: 0x40, Mandatory: Set
AVP Length: 12
Subscription-Id-Type: END_USER_IMSI (1)
AVP: Subscription-Id-Data(444) l=18 f=-M- val=4162796100
AVP Code: 444 Subscription-Id-Data
AVP Flags: 0x40, Mandatory: Set
AVP Length: 18
Subscription-Id-Data: 4162796100
IMSI: 4162796100
[Association IMSI: 4162796100]
Padding: 0000
AVP: Multiple-Services-Credit-Control(456) l=56 f=-M-
AVP: Multiple-Services-Credit-Control(456) l=68 f=-M-
AVP: Multiple-Services-Indicator(455) l=12 f=-M- val=MULTIPLE_SERVICES_SUPPORTED (1)
AVP: Service-Information(873) l=340 f=VM- vnd=TGPP
AVP Code: 873 Service-Information
AVP Flags: 0xc0, Vendor-Specific: Set, Mandatory: Set
AVP Length: 340
AVP Vendor Id: 3GPP (10415)
Service-Information: 0000036ac0000128000028af00000015c000000e000028af3031000000000016c0000023…
AVP: PS-Information(874) l=296 f=VM- vnd=TGPP
AVP Code: 874 PS-Information
AVP Flags: 0xc0, Vendor-Specific: Set, Mandatory: Set
AVP Length: 296
AVP Vendor Id: 3GPP (10415)
PS-Information: 00000015c000000e000028af3031000000000016c0000023000028af30313a30333a3032…
AVP: 3GPP-RAT-Type(21) l=14 f=VM- vnd=TGPP val=3031
AVP: 3GPP-User-Location-Info(22) l=35 f=VM- vnd=TGPP val=30313a30333a30323a39393a30303a30313a30373a6431
AVP: 3GPP-SGSN-MCC-MNC(18) l=18 f=VM- vnd=TGPP val=302990
AVP: 3GPP-Charging-Characteristics(13) l=16 f=VM- vnd=TGPP val=0400
AVP Code: 13 3GPP-Charging-Characteristics
AVP Flags: 0xc0, Vendor-Specific: Set, Mandatory: Set
AVP Length: 16
AVP Vendor Id: 3GPP (10415)
3GPP-Charging-Characteristics: 0400
AVP: 3GPP-Selection-Mode(12) l=13 f=VM- vnd=TGPP val=0
AVP: Called-Station-Id(30) l=21 f=-M- val=wde.stm.sk.ca
AVP: 3GPP-NSAPI(10) l=13 f=VM- vnd=TGPP val=5
AVP: 3GPP-GGSN-MCC-MNC(9) l=18 f=VM- vnd=TGPP val=302990
AVP: 3GPP-IMSI-MCC-MNC(8) l=18 f=VM- vnd=TGPP val=302990
AVP: SGSN-Address(1228) l=18 f=VM- vnd=TGPP val=[Malformed]
AVP: GGSN-Address(847) l=18 f=VM- vnd=TGPP val=[Malformed]
AVP: PDP-Address(1227) l=18 f=VM- vnd=TGPP val=[Malformed]
AVP: 3GPP-PDP-Type(3) l=16 f=VM- vnd=TGPP val=IPv4 (0)
AVP: 3GPP-Charging-Id(2) l=23 f=VM- vnd=TGPP val="0a:00:03:97"
AVP: SMS-Information(2000) l=32 f=VM- vnd=TGPP
AVP: Service-Context-Id(461) l=22 f=-M- val=32251@3gpp.org
AVP: CC-Request-Number(415) l=12 f=-M- val=10
AVP: CC-Request-Type(416) l=12 f=-M- val=INITIAL_REQUEST (1)
AVP: Auth-Application-Id(258) l=12 f=-M- val=Diameter Credit Control Application (4)
AVP: Origin-Realm(296) l=24 f=-M- val=f5techsummit.com
AVP: Origin-Host(264) l=28 f=-M- val=pgw.f5techsummit.com
AVP: Destination-Realm(283) l=27 f=-M- val=visited.traffix.com
AVP: User-Name(1) l=29 f=-M- val=user@f5techsummit.com
AVP: Origin-State-Id(278) l=12 f=-M- val=1
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)
- JRahmAdmin
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_SRISOMCHAIEmployee
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_ThirasuttakornEmployee
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)
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