sipcapture / homer-ui

HOMER Front-End Application (UI)
http://sipcapture.org
GNU Affero General Public License v3.0
64 stars 62 forks source link

Searching for Content within a Header #631

Closed jagnetta closed 6 months ago

jagnetta commented 6 months ago

Good evening,

Included in our INVITEs is a header like this:

X-CC-TRACE: c=LnAQ2VOot4lBBBXKT46rHGY8bJOFdvT9;a=Agent1@JimAgnetta2;i=int-18f53d39bca-1vawdKEqAvzsUXVXohhKBuh9J-phone-00-JimAgnetta2

I am currently and successfully searching for this header, extracting the text following the "i=," and correlating A and B call legs using the extraction. It's great. The correlation ID appears as int-18f53d39bca-1vawdKEqAvzsUXVXohhKBuh9J-phone-00-JimAgnetta2

However, I've been given another request. I'm being asked that we expose the X-CC-TRACE header as a searchable header in the CALL SIP SEARCH widget, which I've added; however, I'm unable to get any searching to work with this header. Ideally we'd like to be able to search for the "c" or the "a" or the "i" values presented in that header. So I figured it would be possible to do something like this in the search field:

%LnAQ2VOot4lBBBXKT46rHGY8bJOFdvT9% or %Agent1@JimAgnetta2% or %int-18f53d39bca-1vawdKEqAvzsUXVXohhKBuh9J-phone-00-JimAgnetta2%

I was expecting to yield the INVITE containing the X-CC-TRACE header above using any of those three search strings above, but nothing works, not even if I search for the entire field.

So, I'm not sure why I'm not able to search on partial strings within that header. Any help? I've attached mapping rule configurations.

Fields mapping SIP call 2024-05-07 12_28_26.json Correlation mapping SIP call 2024-05-07 12_28_22.json

jagnetta commented 6 months ago

I would also like to add. I've exposed thee X-CC-TRACE column in the search results row, and the field is not populating there when the header is present in the message. The column is just blank despite the presence of the header in that message. So the field must not be making it in to the DB properly or something?

jagnetta commented 6 months ago

I've tried reviewing the wiki regarding the field mapping again, but I'm not seeing the problem. Here's a screenshot where you can see the X-CC-TRACE extraction, and even the correlation_id from which it's extracted. The problem is that the call SIP search widget won't successfully search on that field, and the field is blank in the results columns.

image

Here's the relevant parts of heplify-server.toml:

AlegIDs               = ["X-CC-TRACE,i=\"?(.*?)(?:\"|;|$)","X-CC-TRACE"]
ForceALegID           = true
CustomHeader          = ["X-CC-TRACE","X-8x8-CCCI","X-8x8-CarrierList","X-8x8-BTN","X-GR_PLATFORM_ID","X-GR_TENANT_ID","X-8x8-Tenant","X-8x8-Channel","X-8x8-Original-Caller"]
jagnetta commented 6 months ago

OK, I'm starting to understand what's going on. The problem with my using of the X-CC-TRACE header seems to have had something to do with me parsing it for correlation. which caused disruptions in correlation ids, and other things....probably because I did them wrong. :)

I've restarted from scratch starting with field mapping for searching only, and my original problem is gone, and the functionality works. So, now I have to figure out how to combine this with the correlation.

lmangani commented 6 months ago

@jagnetta correlation logic should be indeed completely separate and independent, but once a field exists its usually easy to map it ad-hoc with some type of logic in common with search. TLDR; if the extraction exists it can be used for dynamic correlation.