@henningw commented on this pull request.

Thanks for the pull request, I did a quick review and found a few minor things that should be adressed before merging.


In src/modules/sipcapture/sipcapture.c:

> @@ -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)

Please try to use the existing implementation:
src/core/str.h
130:char* _strnstr(const char *s, const char *find, size_t slen);


In src/modules/sipcapture/sipcapture.c:

>  			} 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");

not needed "" probably from line wrapping


In src/modules/sipcapture/sipcapture.c:

> +{
+	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");

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.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.