- it doesn't stop the embedded interpreter, but it can trigger the
drop() effects (e.g., dropping a branch)
... | ... |
@@ -64,6 +64,27 @@ sr_kemi_module_t* sr_kemi_modules_get(void) |
64 | 64 |
return _sr_kemi_modules; |
65 | 65 |
} |
66 | 66 |
|
67 |
+/** |
|
68 |
+ * |
|
69 |
+ */ |
|
70 |
+static run_act_ctx_t *_sr_kemi_act_ctx = NULL; |
|
71 |
+ |
|
72 |
+/** |
|
73 |
+ * |
|
74 |
+ */ |
|
75 |
+void sr_kemi_act_ctx_set(run_act_ctx_t *ctx) |
|
76 |
+{ |
|
77 |
+ _sr_kemi_act_ctx = ctx; |
|
78 |
+} |
|
79 |
+ |
|
80 |
+/** |
|
81 |
+ * |
|
82 |
+ */ |
|
83 |
+run_act_ctx_t* sr_kemi_act_ctx_get(void) |
|
84 |
+{ |
|
85 |
+ return _sr_kemi_act_ctx; |
|
86 |
+} |
|
87 |
+ |
|
67 | 88 |
/** |
68 | 89 |
* |
69 | 90 |
*/ |
... | ... |
@@ -94,6 +115,17 @@ static int lua_sr_kemi_info(sip_msg_t *msg, str *txt) |
94 | 115 |
return 0; |
95 | 116 |
} |
96 | 117 |
|
118 |
+/** |
|
119 |
+ * |
|
120 |
+ */ |
|
121 |
+static int lua_sr_kemi_drop(sip_msg_t *msg) |
|
122 |
+{ |
|
123 |
+ if(_sr_kemi_act_ctx==NULL) |
|
124 |
+ return 0; |
|
125 |
+ _sr_kemi_act_ctx->run_flags |= EXIT_R_F|DROP_R_F; |
|
126 |
+ return 0; |
|
127 |
+} |
|
128 |
+ |
|
97 | 129 |
/** |
98 | 130 |
* |
99 | 131 |
*/ |
... | ... |
@@ -113,6 +145,11 @@ static sr_kemi_t _sr_kemi_core[] = { |
113 | 145 |
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, |
114 | 146 |
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } |
115 | 147 |
}, |
148 |
+ { str_init(""), str_init("drop"), |
|
149 |
+ SR_KEMIP_NONE, lua_sr_kemi_drop, |
|
150 |
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, |
|
151 |
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } |
|
152 |
+ }, |
|
116 | 153 |
|
117 | 154 |
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } |
118 | 155 |
}; |
... | ... |
@@ -24,6 +24,7 @@ |
24 | 24 |
|
25 | 25 |
#include "str.h" |
26 | 26 |
#include "parser/msg_parser.h" |
27 |
+#include "action.h" |
|
27 | 28 |
|
28 | 29 |
#define SR_KEMIP_NONE (0) /* no type */ |
29 | 30 |
#define SR_KEMIP_INT (1<<0) /* type integer */ |
... | ... |
@@ -107,4 +108,7 @@ int sr_kemi_cbname_list_init(void); |
107 | 108 |
int sr_kemi_cbname_lookup_name(str *name); |
108 | 109 |
str* sr_kemi_cbname_lookup_idx(int idx); |
109 | 110 |
|
111 |
+void sr_kemi_act_ctx_set(run_act_ctx_t *ctx); |
|
112 |
+run_act_ctx_t* sr_kemi_act_ctx_get(void); |
|
113 |
+ |
|
110 | 114 |
#endif |