12 mar 2013 kl. 12:31 skrev Jason Penton <jason.penton(a)gmail.com>om>:
+/**
+ * Returns the first header structure for a given header name.
+ * @param msg - the SIP message to look into
+ * @param header_name - the name of the header to search for
+ * @returns the hdr_field on success or NULL if not found
+ */
+struct hdr_field* cscf_get_header(struct sip_msg * msg, str header_name) {
+ struct hdr_field *h;
+ if (parse_headers(msg, HDR_EOH_F, 0) < 0) {
+ LM_ERR("cscf_get_path: error parsing headers\n");
+ return NULL ;
+ }
+ h = msg->headers;
+ while (h) {
+ if (h->name.len == header_name.len
+ && strncasecmp(h->name.s, header_name.s, header_name.len) == 0)
+ break;
+ h = h->next;
+ }
+ return h;
+}
+
Just a small philosophical note. I think we should be careful not to rebuild Kamailio in a
specific "IMS" version.
Generic functions like this one doesn't belong in the IMS library, it should exist
(and maybe does) in the
core libraries.
Let's try to merge functionality where we can and not complicate things.
/O