Module: kamailio
Branch: master
Commit: ad4faf03628db45d30f27358b81afd8e0bee03c0
URL:
https://github.com/kamailio/kamailio/commit/ad4faf03628db45d30f27358b81afd8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-10-26T16:11:42+02:00
siputils: export add_uri_param() to kemi
---
Modified: src/modules/siputils/checks.c
Modified: src/modules/siputils/checks.h
Modified: src/modules/siputils/siputils.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ad4faf03628db45d30f27358b81afd8…
Patch:
https://github.com/kamailio/kamailio/commit/ad4faf03628db45d30f27358b81afd8…
---
diff --git a/src/modules/siputils/checks.c b/src/modules/siputils/checks.c
index d9730ddad1..c174662d8d 100644
--- a/src/modules/siputils/checks.c
+++ b/src/modules/siputils/checks.c
@@ -359,17 +359,15 @@ int w_uri_param_any(struct sip_msg* _msg, char* _param, char*
_str2)
}
/*
- * Adds a new parameter to Request URI
+ * Adds a new parameter to Request URI - kemi export
*/
-int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2)
+int ki_add_uri_param(struct sip_msg* _msg, str* param)
{
- str *param, *cur_uri, new_uri;
+ str *cur_uri, new_uri;
struct sip_uri *parsed_uri;
char *at;
- param = (str*)_param;
-
- if (param->len == 0) {
+ if (param==NULL || param->len == 0) {
return 1;
}
@@ -467,6 +465,14 @@ int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2)
return 1;
}
+/*
+ * Adds a new parameter to Request URI - cfg export
+ */
+int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2)
+{
+ return ki_add_uri_param(_msg, (str*)_param);
+}
+
/*
* Remove param from Request URI
*/
diff --git a/src/modules/siputils/checks.h b/src/modules/siputils/checks.h
index 164f086f26..eaeaca3f81 100644
--- a/src/modules/siputils/checks.h
+++ b/src/modules/siputils/checks.h
@@ -65,7 +65,7 @@ int uri_param_2(struct sip_msg* _msg, char* _param, char* _value);
* Adds a new parameter to Request URI
*/
int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2);
-
+int ki_add_uri_param(struct sip_msg* _msg, str* param);
/*
* Converts URI, if it is tel URI, to SIP URI. Returns 1, if
diff --git a/src/modules/siputils/siputils.c b/src/modules/siputils/siputils.c
index 91b2d370d0..5db1a67cfd 100644
--- a/src/modules/siputils/siputils.c
+++ b/src/modules/siputils/siputils.c
@@ -732,6 +732,11 @@ static sr_kemi_t sr_kemi_siputils_exports[] = {
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("siputils"), str_init("add_uri_param"),
+ SR_KEMIP_INT, ki_add_uri_param,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};