[sr-dev] git:master:f94e6d12: siputils: exported is_uri() to kemi interface
Daniel-Constantin Mierla
miconda at gmail.com
Mon Oct 8 10:10:46 CEST 2018
Module: kamailio
Branch: master
Commit: f94e6d12c1fb2e3bba5f603b286ef0fe786fd2e1
URL: https://github.com/kamailio/kamailio/commit/f94e6d12c1fb2e3bba5f603b286ef0fe786fd2e1
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-10-08T09:59:01+02:00
siputils: exported is_uri() to kemi interface
---
Modified: src/modules/siputils/siputils.c
---
Diff: https://github.com/kamailio/kamailio/commit/f94e6d12c1fb2e3bba5f603b286ef0fe786fd2e1.diff
Patch: https://github.com/kamailio/kamailio/commit/f94e6d12c1fb2e3bba5f603b286ef0fe786fd2e1.patch
---
diff --git a/src/modules/siputils/siputils.c b/src/modules/siputils/siputils.c
index bfd90d020a..a234188b9a 100644
--- a/src/modules/siputils/siputils.c
+++ b/src/modules/siputils/siputils.c
@@ -65,6 +65,7 @@
#include "../../core/error.h"
#include "../../core/kemi.h"
#include "../../core/parser/parse_option_tags.h"
+#include "../../core/parser/parse_uri.h"
#include "ring.h"
#include "options.h"
@@ -457,6 +458,22 @@ static int fixup_option(void** param, int param_no) {
return 0;
}
+/*
+ * Check if pseudo variable contains a valid uri
+ */
+static int ki_is_uri(sip_msg_t* msg, str* suri)
+{
+ sip_uri_t turi;
+
+ if(suri==NULL || suri->s==NULL || suri->len<=0) {
+ return -1;
+ }
+ if(parse_uri(suri->s, suri->len, &turi)!=0) {
+ return -1;
+ }
+ return 1;
+}
+
/**
*
*/
@@ -481,6 +498,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("is_uri"),
+ SR_KEMIP_INT, ki_is_uri,
+ { 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 } }
};
More information about the sr-dev
mailing list