<p><b>@henningw</b> commented on this pull request.</p>
<p>Thanks for the pull request, I did a quick review and found a few minor things that should be adressed before merging.</p><hr>
<p>In <a href="https://github.com/kamailio/kamailio/pull/2245#discussion_r390859278">src/modules/sipcapture/sipcapture.c</a>:</p>
<pre style='color:#555'>> @@ -434,6 +436,64 @@ struct module_exports exports = {
destroy /* module destroy function */
};
+/*
+ * Find the first occurrence of find in s, where the search is limited to the
+ * first slen characters of s.
+ */
+char *strnstr(const char *s, const char *find, size_t slen)
</pre>
<p>Please try to use the existing implementation:<br>
src/core/str.h<br>
130:char* _strnstr(const char *s, const char *find, size_t slen);</p>
<hr>
<p>In <a href="https://github.com/kamailio/kamailio/pull/2245#discussion_r390864204">src/modules/sipcapture/sipcapture.c</a>:</p>
<pre style='color:#555'>> } else {
- if(cb->star) { /* in the case Contact is "*" */
- memset(&contact, 0, sizeof(contact));
- contact.user.s = star_contact.s;
- contact.user.len = star_contact.len;
+ LM_DBG("error while parsing <Contact:> header\n");
+ }
+ } else {
+ cb = (contact_body_t*)msg->contact->parsed;
+ if (cb) {
+ if (cb->contacts) {
+ if (parse_uri(cb->contacts->uri.s, cb->contacts->uri.len, &contact) < 0) {
+ if (!parse_bad_msgs) {
+ LOG(L_ERR, "ERROR: do_action: bad contact dropping"" packet\n");
</pre>
<p>not needed "" probably from line wrapping</p>
<hr>
<p>In <a href="https://github.com/kamailio/kamailio/pull/2245#discussion_r390868147">src/modules/sipcapture/sipcapture.c</a>:</p>
<pre style='color:#555'>> +{
+ char *tmp = NULL;
+ char *end;
+ struct hdr_field *hdr = NULL;
+
+ tmp= msg->unparsed;
+ end = msg->buf+msg->len;
+ tmp = strnstr(tmp, "Call-ID", (int)(end - tmp) );
+
+ if (tmp == NULL) {
+ LM_DBG("Bad msg callid not found\n");
+ EMPTY_STR(sco->callid);
+ } else {
+ hdr=pkg_malloc(sizeof(struct hdr_field));
+ if (unlikely(hdr==0)){
+ LOG(L_ERR, "ERROR:parse_headers: memory allocation error\n");
</pre>
<p>consider removing this log statement and just use PKG_MEM_ERROR macro instead. The "parse_headers" prefix makes also not much sense in this context, I think.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2245?email_source=notifications&email_token=ABO7UZMFCT7S3QNEQ46G33DRG5QLRA5CNFSM4LFRXTUKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCY22Q5I#pullrequestreview-372615285">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZJDG2X6PICR3I7MWPDRG5QLRANCNFSM4LFRXTUA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZM36VHEKTW646PYDQ3RG5QLRA5CNFSM4LFRXTUKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCY22Q5I.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2245?email_source=notifications\u0026email_token=ABO7UZMFCT7S3QNEQ46G33DRG5QLRA5CNFSM4LFRXTUKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCY22Q5I#pullrequestreview-372615285",
"url": "https://github.com/kamailio/kamailio/pull/2245?email_source=notifications\u0026email_token=ABO7UZMFCT7S3QNEQ46G33DRG5QLRA5CNFSM4LFRXTUKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCY22Q5I#pullrequestreview-372615285",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>