I just want to filter all event that contains "Event: Hangup and “Channel: PJSIP/ANCONA_UFFICIO” against an event like this:
Event: Hangup
Privilege: call,all
Channel: PJSIP/ANCONA_UFFICIO-8f8f88
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: xxxxxxx
CallerIDName: xxxxxxx
ConnectedLineNum: 235
ConnectedLineName: WASSILIS IT
Language: it
AccountCode:
Context: ext-group
Exten: h
Priority: 1
Uniqueid: 1700241723.5022
Linkedid: 1700241723.5022
Cause: 16
Cause-txt: Normal Clearing
So I’m using this regex:
Action: Login
Username: user
Secret: mypassword
Action: Filter
ActionID: 998
Operation: Add
Filter: [\s\S]*Event: Hangup\b[\s\S]*Channel: PJSIP\/ANCONA_UFFICIO[\s\S]*
and it doesn’t works, my ami console doesn’t show any events on any kind of hangup, the strange thing is that if I separate the two rules like this, it will work
Action: Filter
ActionID: 998
Operation: Add
Filter: [\s\S]*Event: Hangup\b[\s\S]*
Action: Filter
ActionID: 998
Operation: Add
Filter: [\s\S]*Channel: PJSIP\/ANCONA_UFFICIO[\s\S]*
but in this way is like an OR logical condition but I need and AND. I tried the above regex in regex101: build, test, and debug regex and it’s working as expected without any global flag activated. So must be sometghing in how regex works in AMI