[sr-dev] git:master:46334c18: core: exported script flags functions to kemi
Daniel-Constantin Mierla
miconda at gmail.com
Mon Jun 20 19:01:16 CEST 2016
Module: kamailio
Branch: master
Commit: 46334c18bd35ec9e45603d029953f3a5bb555f96
URL: https://github.com/kamailio/kamailio/commit/46334c18bd35ec9e45603d029953f3a5bb555f96
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-06-20T18:59:37+02:00
core: exported script flags functions to kemi
- alternative related to GH #666
---
Modified: kemi.c
---
Diff: https://github.com/kamailio/kamailio/commit/46334c18bd35ec9e45603d029953f3a5bb555f96.diff
Patch: https://github.com/kamailio/kamailio/commit/46334c18bd35ec9e45603d029953f3a5bb555f96.patch
---
diff --git a/kemi.c b/kemi.c
index 5052885..cbbcbb8 100644
--- a/kemi.c
+++ b/kemi.c
@@ -301,6 +301,52 @@ static int sr_kemi_core_isbflagset(sip_msg_t *msg, int flag)
/**
*
*/
+static int sr_kemi_core_setsflag(sip_msg_t *msg, int flag)
+{
+ if (!flag_in_range(flag)) {
+ LM_ERR("invalid flag parameter %d\n", flag);
+ return SR_KEMI_FALSE;
+ }
+
+ setsflag(flag);
+ return SR_KEMI_TRUE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_resetsflag(sip_msg_t *msg, int flag)
+{
+ if (!flag_in_range(flag)) {
+ LM_ERR("invalid flag parameter %d\n", flag);
+ return SR_KEMI_FALSE;
+ }
+
+ resetsflag(flag);
+ return SR_KEMI_TRUE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_issflagset(sip_msg_t *msg, int flag)
+{
+ int ret;
+
+ if (!flag_in_range(flag)) {
+ LM_ERR("invalid flag parameter %d\n", flag);
+ return SR_KEMI_FALSE;
+ }
+
+ ret = issflagset(flag);
+ if(ret>0)
+ return SR_KEMI_TRUE;
+ return SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
static int sr_kemi_core_seturi(sip_msg_t *msg, str *uri)
{
if(uri==NULL || uri->s==NULL) {
@@ -526,6 +572,21 @@ static sr_kemi_t _sr_kemi_core[] = {
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init(""), str_init("setsflag"),
+ SR_KEMIP_BOOL, sr_kemi_core_setsflag,
+ { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init(""), str_init("resetsflag"),
+ SR_KEMIP_BOOL, sr_kemi_core_resetsflag,
+ { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init(""), str_init("issflagset"),
+ SR_KEMIP_BOOL, sr_kemi_core_issflagset,
+ { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init(""), str_init("seturi"),
SR_KEMIP_BOOL, sr_kemi_core_seturi,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
More information about the sr-dev
mailing list