Piotr Legiecki
10/02/2025, 8:32 AM[PARSER]
Name message-extract
Format regex
Regex /^(?<message>("([^"]*)"|([^;]+)));\s*(?<schema>[^;]+)\s*;\s*(?<applicationName>[^;]+);\s*(?<applicationInstance>[^;]+);\s*(?<serviceName>[^;]+);\s*(?<serviceInstance>[^;]+);\s*(?<correlationID>[^;]+);\s*(?<sequenceNumber>.*);$/m
[FILTER]
name parser
match *
key_name message
parser message-extract
Reserve_Data On
Input line looks like this:
"#EventLoop Handling message: RequestEvent[request=Request[transactionId=T_SERVER_OPTIONS-cd8bfb98-f03d-4949-841c-96203ef64b46,dialogId=<null>,headers=[Content-Length: 0, Via: SIP/2.0/UDP 10.16.255.42:5060;branch=z9hG4bK352352f1281141f0b44ce165dac2f9cb;rport=5060;received=10.16.255.42, To: <sip:B2BUA@10.16.206.31:5060>, From: <sip:UTG@10.16.255.42:5060>;tag=1843611719, Call-ID: 8c59657dd1fc49e18fceaf1d5c3c47bc, CSeq: 480289 OPTIONS, Max-Forwards: 70, User-Agent: UTG, Allow: ACK, Allow: BYE, Allow: CANCEL, Allow: INFO, Allow: INVITE, Allow: NOTIFY, Allow: OPTIONS, Allow: REFER, Allow: REGISTER, Allow: SUBSCRIBE, Allow: UPDATE, Allow: MESSAGE],contents=[],getRequestMethod=OPTIONS,requestUri=sip:10.16.206.31:5060],dialogState=<null>]"; FRQ-v4; B2BUA; B2BUA-PSMB-LXMSS-01; B2BUA; B2BUA-PSMB-LXMSS-01; ; 1220668370183000;
and output (only important part:
...
"message": " \"#EventLoop Handling message: RequestEvent[request=Request[transactionId=T_SERVER_OPTIONS-cd8bfb98-f03d-4949-841c-96203ef64b46,dialogId=<null>,headers=[Content-Length: 0, Via: SIP/2.0/UDP 10.16.255.42:5060",
"schema": "branch=z9hG4bK352352f1281141f0b44ce165dac2f9cb",
"applicationName": "rport=5060",
"applicationInstance": "received=10.16.255.42, To: <sip:B2BUA@10.16.206.31:5060>, From: <sip:UTG@10.16.255.42:5060>",
...
Fields are separated with ';', tricky 'message' field has extra ';' inside but within "", so this regex should handle the extra ';'. And it does it when tested with Rubular online editor. But here in FB it does not work, as you can see in the output: field just after message (schema) has value taken from message field where it met ';'.
I do not understand this behavior. Looks like FB has problems with handling ".