[sr-dev] [kamailio/kamailio] sipcapture: table name corrupted (#566)

Seudin Kasumovic notifications at github.com
Fri Apr 15 11:31:41 CEST 2016


I thought on Kamailio docs. Thanks for links.

So, workaround in my setup is to always call
sip_capture("$var(table_format)") with table format as argument, even don't
need to shard data, to get correct table name.

Kind regards and thanks,
Seudin

On Fri, Apr 15, 2016 at 10:03 AM, Alexandr Dubovikov <
notifications at github.com> wrote:

> the docs are here: https://github.com/sipcapture/homer/wiki
>
> since H5 we generate table name depends on message type and datestamp:
>
> I have pointed you already to the new kamailio's config:
>
>
> https://github.com/sipcapture/homer-api/blob/master/examples/sipcapture/sipcapture.kamailio#L814
>
>
> https://github.com/sipcapture/homer-api/blob/master/examples/sipcapture/sipcapture.kamailio#L849
>
>
> https://github.com/sipcapture/homer-api/blob/master/examples/sipcapture/sipcapture.kamailio#L855
>
> at the end (L855) you push the generated table name to sip_capture function
> and a message will be inserted to the table.
>
> modparam "table_name" is only for H3
>
> Wbr,
> Alexandr
>
>
>
>
>
>
>
>
>
>
>
>
>
> On 15 April 2016 at 09:52, Seudin Kasumovic <notifications at github.com>
> wrote:
>
>
> > Hi,
> >
> > I'm testing on 4.4.
> >
> > The 'new design' isn't documented, so I can't figure out how the name
> will
> > be generated.
> > When use simple config:
> >
> > modparam("sipcapture", "db_url", DBURL)
> > modparam("sipcapture", "capture_on", 1)
> > modparam("sipcapture", "hep_capture_on", 1)
> > modparam("sipcapture", "raw_ipip_capture_on", 0)
> > modparam("sipcapture", "table_name", "sip_capture")
> >
> > sipcapture uses given table name as format string, but the final result
> was
> > 'sip_capture.....A'. So no any timestamp in the name. The reason for this
> > could be next two lines:
> >
> > ntab.len = strftime(strftime_buf, sizeof(strftime_buf), table->s,
> &capt_ts);
> > ntab.s = strftime_buf;
> >
> > The table->s not necessary ends with '\0', because it's part of Kamailio
> > internal str structure.
> > Avoid non zero terminated string will work in this case.
> >
> > Parsing loop in parse_table_names function doesn't add '\0' at the end of
> > table name.
> > Suggested patch is here.
> >
> > diff --git a/modules/sipcapture/sipcapture.c
> b/modules/sipcapture/sipcapture.c
> > index 41d153e..2bdb4b4 100644
> > --- a/modules/sipcapture/sipcapture.c
> > +++ b/modules/sipcapture/sipcapture.c
> > @@ -436,8 +436,9 @@ int parse_table_names (str table_name, str **
> table_names){
> > {
> > LM_INFO ("INFO: table name:%s\n",p);
> > names[i].len = strlen (p);
> > - names[i].s = (char *)pkg_malloc(sizeof(char) *names[i].len);
> > + names[i].s = (char *)pkg_malloc(sizeof(char) *(names[i].len + 1));
> > memcpy(names[i].s, p, names[i].len);
> > + names[i].s[names[i].len] = '\0';
> > i++;
> > p = strtok (NULL, "| \t");
> > }
> >
> > BTW, can you explain what 'table->s' will contain (format string required
> > by strftime) using provided example config ?
> >
> > Thanks,
> > Seudin
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly or view it on GitHub
> > <https://github.com/kamailio/kamailio/issues/566#issuecomment-210343805>
> >
>
>> You are receiving this because you authored the thread.
> Reply to this email directly or view it on GitHub
> <https://github.com/kamailio/kamailio/issues/566#issuecomment-210346518>
>



-- 
MSC Seudin Kasumovic
Tuzla, Bosnia


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/566#issuecomment-210382956
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160415/714e1366/attachment.html>


More information about the sr-dev mailing list