kamailio / kamailio

Kamailio - The Open Source SIP Server for large VoIP and real-time communication platforms -
https://www.kamailio.org
Other
2.29k stars 955 forks source link

Diversion headers not parsed by sipcapture #650

Closed lcligny closed 8 years ago

lcligny commented 8 years ago

Hello,

I'm using kamailio 4.4 as sipcapture for homer 5 and the SIP and RTCP capture is working. I have the data on the DB and homer show me all I want, but one thing: the diversion headers. I just tested again with kamailio 4.4 nighly for debian 7.

To be more precise, the diversion headers are correctly sent by hep encapsulation as I can see them into the "msg" fields of my captured SIP INVITE rows. But the diversion data is not inserted into the corresponding "diversion" field, and therefore is not searchable by Homer.

I have no insertion errors on the DB side, and the INSERT statements debug shows me that the value is always empty, while I have a "Diversion: sip:XXXXXXXXX@192.168.XX.X;reason=unconditional" into the msg field.

If you need some logs to help track, feel free to ask me.

Thank you for your help.

adubovikov commented 8 years ago

If you check the sipcapture.c, you can see that if the Diversion header exists, it will be inserted:

https://github.com/kamailio/kamailio/blob/master/modules/sipcapture/sipcapture.c#L1755

please be sure, that Diversion header was correctly parsed and was not skipped

lcligny commented 8 years ago

You are right, maybe it is not parsed, but the problem remains the same for me, I can't search by diversion header. The diversion header is on the HEP "msg" DB field, but not in the "diversion" DB field for the very same INVITE record.

I first thought it was an error on the static str https://github.com/kamailio/kamailio/blob/master/modules/sipcapture/sipcapture.c#L184

I changed with:

static str diversion_column = str_init("diversion");

with no luck.

You'll find attached a SIP INVITE with diversion pcap exported from Homer, the entire INVITE row corresponding in the DB, and a copy of the "Message" tab from Homer for this call.

Hope this help. sipcapture issue #650.zip

adubovikov commented 8 years ago

no this not help, because you have to be sure that diversion was parsed. If you can add LDEBUG or LERR after check diversion header, it can help a lot.

lcligny commented 8 years ago

Thanks for your help, I didn't understand what you meant in your first response.

With debug printed like this:

/* Diversion */
        if(msg->diversion) {
                sco.diversion = msg->diversion->body;
                LM_DBG("Diversion: [%.*s]\n", sco.diversion.len, sco.diversion.s);
        }
        else { EMPTY_STR(sco.diversion);}

I can see the following in my logs (mobile numer XXed):

/usr/sbin/kamailio[12010]: DEBUG: sipcapture [sipcapture.c:1759]: sip_capture(): Diversion: [sip:63XXXXXXX@192.168.15.2;reason=unconditional]

adubovikov commented 8 years ago

can you please check: https://github.com/adubovikov/kamailio/commit/eac041d488c69b34a06cfa5b5b55e7b44f89ea13

this part was missed ;-) thank for report.

lcligny commented 8 years ago

Thanks, I also ended up with this missing DB column on sipcapture_store(). But I think we also need:

static str diversion_column = str_init("diversion");

since on the DB schema we create a "diversion", not a "diversion_user" column.

adubovikov commented 8 years ago

https://github.com/adubovikov/kamailio/commit/0f5a419d2888c91b29cc01544b9cb32f29db1a37 done

please test it!

lcligny commented 8 years ago

Now diversion headers are correclty inserted into database.

Thank you ;)