sipcapture / homer-app

HOMER 7.x Front-End and API Server
http://sipcapture.io
GNU Affero General Public License v3.0
207 stars 85 forks source link

Filter for X header #415

Closed noahrotheray closed 3 years ago

noahrotheray commented 3 years ago

Hi Guys,

I am trying to enable myself to be able to search for the value custom header we set when terminating outbound calls.

I have added an X header to our INVITES called: X-CID, which contains a uuid we generate outside of freeswitch. I want to add a field mapping that allows me to specify the uuid im looking and give me all the SIP calls that match that uuid.

So far ive tried adding the CustomHeader to heplify-server.toml and creating a field mapping in my search profile:

    {
        "id": "data_header.X-CID",
        "name": "VoiceID",
        "type": "string",
        "index": "none",
        "form_type": "input",
        "position": 4,
        "skip": false,
        "hide": true,
        "sid_type": true
    },

But no luck yet...my understanding of these mappings is limited, but some guidance would be appreciated.

adubovikov commented 3 years ago

Are you sure that this field exists ? Try to execute a query in pgsql CLI and looking for data.header.X-CID, in CLI you have to use this syntax:

data_header->>'X-CID' LIKE "%your_value%"
noahrotheray commented 3 years ago

Thanks Alexandr,

I extracted the entry from psql to get all the data_header fields: {"cseq": "32618723 INVITE", "callid": "d7f4efa2-f2d6-1239-b8b0-0af0d01ff99c", "method": "INVITE", "to_user": "111111111", "from_tag": "UeBZD5aU17atD", "from_user": "22222222", "ruri_user": "11111111", "user_agent": "FreeSWITCH-mod_sofia/1.10.5-release-17-25569c1631~64bit", "ruri_domain": "1.2.3.4"}

Freeswitch is definitely attaching the X header in the INVITE, as its visible in the raw column for this entry. What is the process to get this field added to the HomerDB?

noahrotheray commented 3 years ago

Hi Alexandr, I found my issue!

My field mapping was incorrect, I can now filter for this value :)

I'm going to give the correlation mapping a try now...will open a new issue if I get stuck.

adubovikov commented 3 years ago

perfect :-)