Module: kamailio
Branch: master
Commit: f614c39a693cea39e3d96920fda3aa7a111c1d67
URL:
https://github.com/kamailio/kamailio/commit/f614c39a693cea39e3d96920fda3aa7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-08-02T09:02:14+02:00
siputils: functions to compare uri and aor exported to kemi
---
Modified: src/modules/siputils/sipops.c
Modified: src/modules/siputils/sipops.h
Modified: src/modules/siputils/siputils.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f614c39a693cea39e3d96920fda3aa7…
Patch:
https://github.com/kamailio/kamailio/commit/f614c39a693cea39e3d96920fda3aa7…
---
diff --git a/src/modules/siputils/sipops.c b/src/modules/siputils/sipops.c
index 4cba3c3181..5aba445b02 100644
--- a/src/modules/siputils/sipops.c
+++ b/src/modules/siputils/sipops.c
@@ -40,6 +40,18 @@
#include "sipops.h"
+int ki_cmp_uri(sip_msg_t *msg, str *uri1, str *uri2)
+{
+ int ret;
+
+ ret = cmp_uri_str(uri1, uri2);
+ if(ret==0)
+ return 1;
+ if(ret>0)
+ return -1;
+ return -2;
+}
+
int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2)
{
str s1;
@@ -64,6 +76,18 @@ int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2)
return -2;
}
+int ki_cmp_aor(sip_msg_t *msg, str *uri1, str *uri2)
+{
+ int ret;
+
+ ret = cmp_aor_str(uri1, uri2);
+ if(ret==0)
+ return 1;
+ if(ret>0)
+ return -1;
+ return -2;
+}
+
int w_cmp_aor(struct sip_msg *msg, char *uri1, char *uri2)
{
str s1;
diff --git a/src/modules/siputils/sipops.h b/src/modules/siputils/sipops.h
index 9926358e0a..7cbe77bd98 100644
--- a/src/modules/siputils/sipops.h
+++ b/src/modules/siputils/sipops.h
@@ -34,7 +34,9 @@
#include "../../core/parser/msg_parser.h"
+int ki_cmp_uri(sip_msg_t *msg, str *uri1, str *uri2);
int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2);
+int ki_cmp_aor(sip_msg_t *msg, str *uri1, str *uri2);
int w_cmp_aor(struct sip_msg *msg, char *uri1, char *uri2);
int ki_cmp_hdr_name(sip_msg_t *msg, str *shname1, str *shname2);
int w_cmp_hdr_name(sip_msg_t *msg, char *hname1, char *hname2);
diff --git a/src/modules/siputils/siputils.c b/src/modules/siputils/siputils.c
index a23408ab79..747bf408fa 100644
--- a/src/modules/siputils/siputils.c
+++ b/src/modules/siputils/siputils.c
@@ -740,6 +740,16 @@ static sr_kemi_t sr_kemi_siputils_exports[] = {
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("siputils"), str_init("cmp_uri"),
+ SR_KEMIP_INT, ki_cmp_uri,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("siputils"), str_init("cmp_aor"),
+ SR_KEMIP_INT, ki_cmp_aor,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("siputils"), str_init("cmp_hdr_name"),
SR_KEMIP_INT, ki_cmp_hdr_name,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,