Module: kamailio
Branch: master
Commit: 4eb39425e2bb9322e0cc4f0c013aaeab1fcfb9dd
URL:
https://github.com/kamailio/kamailio/commit/4eb39425e2bb9322e0cc4f0c013aaea…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-05-17T10:40:54+02:00
pv: added $cts - contact header star status
- 1 if it is *, 0 otherwise
---
Modified: src/modules/pv/pv.c
Modified: src/modules/pv/pv_core.c
Modified: src/modules/pv/pv_core.h
---
Diff:
https://github.com/kamailio/kamailio/commit/4eb39425e2bb9322e0cc4f0c013aaea…
Patch:
https://github.com/kamailio/kamailio/commit/4eb39425e2bb9322e0cc4f0c013aaea…
---
diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index 3226c773a2e..ec6488d1f04 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -163,6 +163,8 @@ static pv_export_t mod_pvs[] = {
PVT_OTHER, pv_get_cseq_body, 0, 0, 0, 0, 0},
{{"ct", (sizeof("ct") - 1)}, /* */
PVT_OTHER, pv_get_contact, 0, 0, 0, 0, 0},
+ {{"cts", (sizeof("cts") - 1)}, /* */
+ PVT_OTHER, pv_get_contact_star, 0, 0, 0, 0, 0},
{{"ctu", (sizeof("ctu") - 1)}, /* */
PVT_OTHER, pv_get_contact_uri, 0, 0, 0, 0, 0},
{{"cT", (sizeof("cT") - 1)}, /* */
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 8eed3c2e019..87345490af1 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -404,6 +404,29 @@ int pv_get_contact_uri(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
return pv_get_strval(msg, param, res, &cb->contacts->uri);
}
+int pv_get_contact_star(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
+{
+ contact_body_t *cb = NULL;
+
+ if(msg == NULL)
+ return -1;
+
+ if(msg->contact == NULL && parse_headers(msg, HDR_CONTACT_F, 0) == -1) {
+ LM_DBG("no contact header\n");
+ return pv_get_null(msg, param, res);
+ }
+ if(parse_contact_headers(msg) < 0) {
+ return pv_get_null(msg, param, res);
+ }
+
+ cb = (contact_body_t *)msg->contact->parsed;
+
+ if(cb->star == 1) {
+ return pv_get_uintval(msg, param, res, 1);
+ }
+ return pv_get_uintval(msg, param, res, 0);
+}
+
int pv_get_xto_attr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res,
struct to_body *xto, int type)
{
diff --git a/src/modules/pv/pv_core.h b/src/modules/pv/pv_core.h
index 7d4681dab96..53951340db1 100644
--- a/src/modules/pv/pv_core.h
+++ b/src/modules/pv/pv_core.h
@@ -67,6 +67,9 @@ int pv_get_contact(struct sip_msg *msg, pv_param_t *param, pv_value_t
*res);
int pv_get_contact_uri(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
+int pv_get_contact_star(
+ struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
+
int pv_get_xto_attr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res,
struct to_body *xto, int type);