Module: kamailio
Branch: master
Commit: d2dbe98e072f59138b9974ab8f147bcfef5f983e
URL:
https://github.com/kamailio/kamailio/commit/d2dbe98e072f59138b9974ab8f147bc…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-09-07T10:50:40+02:00
core: relocate parse_contact_hader() to parser folder
---
Modified: src/core/parser/contact/parse_contact.c
Modified: src/core/parser/contact/parse_contact.h
Modified: src/core/select_core.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d2dbe98e072f59138b9974ab8f147bc…
Patch:
https://github.com/kamailio/kamailio/commit/d2dbe98e072f59138b9974ab8f147bc…
---
diff --git a/src/core/parser/contact/parse_contact.c
b/src/core/parser/contact/parse_contact.c
index 37a075a17d..242c4a0756 100644
--- a/src/core/parser/contact/parse_contact.c
+++ b/src/core/parser/contact/parse_contact.c
@@ -228,7 +228,7 @@ int contact_iterator(contact_t** c, struct sip_msg* msg, contact_t*
prev)
}
/**
- *
+ * Parse all contact headers
*/
int parse_contact_headers(sip_msg_t *msg)
{
@@ -254,3 +254,20 @@ int parse_contact_headers(sip_msg_t *msg)
return 0;
}
+
+/**
+ * Parse first contact header
+ */
+int parse_contact_header(sip_msg_t *msg)
+{
+ if ( !msg->contact && ( parse_headers(msg,HDR_CONTACT_F,0)==-1
+ || !msg->contact)) {
+ LM_DBG("bad msg or missing CONTACT header\n");
+ return -1;
+ }
+
+ if (msg->contact->parsed)
+ return 0;
+
+ return parse_contact(msg->contact);
+}
diff --git a/src/core/parser/contact/parse_contact.h
b/src/core/parser/contact/parse_contact.h
index 4d8e1cd642..e6e38b6e9e 100644
--- a/src/core/parser/contact/parse_contact.h
+++ b/src/core/parser/contact/parse_contact.h
@@ -75,4 +75,9 @@ int contact_iterator(contact_t** c, struct sip_msg* msg, contact_t*
prev);
*/
int parse_contact_headers(sip_msg_t *msg);
+/*
+ * parse first Contact header
+ */
+int parse_contact_header(sip_msg_t *msg);
+
#endif /* PARSE_CONTACT_H */
diff --git a/src/core/select_core.c b/src/core/select_core.c
index 02d393a6ba..9b6e2df2d9 100644
--- a/src/core/select_core.c
+++ b/src/core/select_core.c
@@ -221,18 +221,6 @@ SELECT_uri_header(from)
SELECT_uri_header(refer_to)
SELECT_uri_header(rpid)
-int parse_contact_header( struct sip_msg *msg)
-{
- if ( !msg->contact && ( parse_headers(msg,HDR_CONTACT_F,0)==-1 ||
!msg->contact)) {
- LM_DBG("bad msg or missing CONTACT header\n");
- return -1;
- }
-
- if (msg->contact->parsed)
- return 0;
-
- return parse_contact(msg->contact);
-}
#define get_contact(msg) ((contact_body_t*)(msg->contact->parsed))