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

Alexandr Dubovikov notifications at github.com
Fri Apr 15 10:04:00 CEST 2016


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 are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/566#issuecomment-210346518
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160415/ce259385/attachment-0001.html>


More information about the sr-dev mailing list